aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNardi Ivan <nardi.ivan@gmail.com>2023-10-08 20:36:23 +0200
committerIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-10-09 15:41:46 +0200
commit1366d9415678a44456f4f8e38adef7114a106273 (patch)
tree7c8da81948ca2da57a2c4a1d061604077373f1a5 /src
parent86115a8a65c98d0665100b5ae85cc661d1404783 (diff)
fuzzing: extend fuzzing coverage
Try fuzzing some functions which write to file/file descriptor; to avoid slowing the fuzzer, close its stdout
Diffstat (limited to 'src')
-rw-r--r--src/lib/ndpi_main.c4
-rw-r--r--src/lib/third_party/src/gcrypt/aes.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 274273cb9..87d43f3f2 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -8777,6 +8777,7 @@ void ndpi_generate_options(u_int opt, FILE *options_out) {
if (!options_out) return;
ndpi_str = ndpi_init_detection_module(ndpi_no_prefs);
+ if (!ndpi_str) return;
NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_str, &all);
@@ -8819,6 +8820,8 @@ void ndpi_generate_options(u_int opt, FILE *options_out) {
fprintf(options_out, "%s\n", "WARNING: option -a out of range");
break;
}
+
+ ndpi_exit_detection_module(ndpi_str);
}
/* ****************************************************** */
@@ -9701,7 +9704,6 @@ static int ndpi_is_vowel(char c) {
case 'y': // Not a real vowel...
case 'x': // Not a real vowel...
return(1);
- break;
default:
return(0);
diff --git a/src/lib/third_party/src/gcrypt/aes.c b/src/lib/third_party/src/gcrypt/aes.c
index 61dc2137a..dd9c0c88a 100644
--- a/src/lib/third_party/src/gcrypt/aes.c
+++ b/src/lib/third_party/src/gcrypt/aes.c
@@ -191,7 +191,13 @@ int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
if( aes_init_done == 0 )
{
aes_gen_tables();
+
+ /* Allow to test both aesni and not aesni data path when fuzzing.
+ We can call aes_gen_tables() at every iteration without any issues
+ (performances asides) */
+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
aes_init_done = 1;
+#endif
}
ctx->rk = RK = ctx->buf;