aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-04-03 14:10:37 +0200
committerGitHub <noreply@github.com>2024-04-03 14:10:37 +0200
commit1acc9ee3965c4f88a62dbd2f5cbad75c21f59be0 (patch)
tree90a7888167e3abceb11619ee33b598ae1faa71bf
parent41eef9246c6a3055e3876e3dd7aeaadecb4b76c0 (diff)
Patrica tree: fix handling of mac addresses (#2362)
Found looking at the fuzzer statistics...
-rw-r--r--src/lib/third_party/src/ndpi_patricia.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/third_party/src/ndpi_patricia.c b/src/lib/third_party/src/ndpi_patricia.c
index cf1eef229..5068d7a03 100644
--- a/src/lib/third_party/src/ndpi_patricia.c
+++ b/src/lib/third_party/src/ndpi_patricia.c
@@ -238,6 +238,16 @@ static ndpi_prefix_t * ndpi_New_Prefix2 (int family, void *dest, int bitlen, ndp
}
memcpy (&prefix->add.sin, dest, sizeof(struct in_addr));
}
+ else if(family == AF_MAC) {
+ default_bitlen = 48;
+ if(prefix == NULL) {
+ prefix = (ndpi_prefix_t*)ndpi_calloc(1, sizeof (ndpi_prefix_t));
+ if(!prefix)
+ return (NULL);
+ dynamic_allocated++;
+ }
+ memcpy (prefix->add.mac, dest, 6);
+ }
else {
return (NULL);
}