aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_utils.c
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2024-04-20 18:15:23 +0200
committerGitHub <noreply@github.com>2024-04-20 18:15:23 +0200
commitef891834699db2b0ed16e32fc2d352e8a8419945 (patch)
treedf39f9d6bf678d5286bdd48dd365a1f4828d14f6 /src/lib/ndpi_utils.c
parent905120588bf2a1bb56b280d9accd89e7265b8364 (diff)
fuzz: improvements (#2400)
Create the zip file with all the traces only once. Add a new fuzzer to test "shoco" compression algorithm
Diffstat (limited to 'src/lib/ndpi_utils.c')
-rw-r--r--src/lib/ndpi_utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index 49d86e28d..f75eb3d9c 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -2302,6 +2302,9 @@ int ndpi_hash_find_entry(ndpi_str_hash *h, char *key, u_int key_len, u_int16_t *
ndpi_str_hash_priv *h_priv = (ndpi_str_hash_priv *)h;
ndpi_str_hash_priv *item;
+ if(!key || key_len == 0)
+ return(2);
+
HASH_FIND(hh, h_priv, key, key_len, item);
if (item != NULL) {
@@ -2319,6 +2322,9 @@ int ndpi_hash_add_entry(ndpi_str_hash **h, char *key, u_int8_t key_len, u_int16_
ndpi_str_hash_priv *h_priv = (ndpi_str_hash_priv *)*h;
ndpi_str_hash_priv *item;
+ if(!key || key_len == 0)
+ return(3);
+
HASH_FIND(hh, h_priv, key, key_len, item);
if(item != NULL) {