diff options
Diffstat (limited to 'fuzz')
-rw-r--r-- | fuzz/fuzz_config.cpp | 13 | ||||
-rw-r--r-- | fuzz/fuzz_ndpi_reader.c | 2 | ||||
-rw-r--r-- | fuzz/fuzz_process_packet.c | 2 | ||||
-rw-r--r-- | fuzz/fuzz_readerutils_parseprotolist.cpp | 4 | ||||
-rw-r--r-- | fuzz/fuzz_readerutils_workflow.cpp | 2 |
5 files changed, 15 insertions, 8 deletions
diff --git a/fuzz/fuzz_config.cpp b/fuzz/fuzz_config.cpp index 93bff3313..5c79ede4c 100644 --- a/fuzz/fuzz_config.cpp +++ b/fuzz/fuzz_config.cpp @@ -195,6 +195,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { ndpi_set_config(ndpi_info_mod, NULL, "libgcrypt.init", cfg_value); } if(fuzzed_data.ConsumeBool()) { + value = fuzzed_data.ConsumeIntegralInRange(0, 0x03 + 1); + sprintf(cfg_value, "%d", value); + ndpi_set_config(ndpi_info_mod, NULL, "guess_on_giveup", cfg_value); + } + if(fuzzed_data.ConsumeBool()) { value = fuzzed_data.ConsumeIntegralInRange(0, 1 + 1); sprintf(cfg_value, "%d", value); ndpi_set_config(ndpi_info_mod, NULL, "flow_risk_lists.load", cfg_value); @@ -214,7 +219,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { sprintf(cfg_value, "%d", value); ndpi_set_config(ndpi_info_mod, NULL, "flow_risk.crawler_bot.list.load", cfg_value); } - + if(fuzzed_data.ConsumeBool()) { + value = fuzzed_data.ConsumeIntegralInRange(0, 3 + 1); + sprintf(cfg_value, "%d", value); + ndpi_set_config(ndpi_info_mod, NULL, "log.level", cfg_value); + } if(fuzzed_data.ConsumeBool()) { value = fuzzed_data.ConsumeIntegralInRange(0, 16777215 / 2); /* max / 2 instead of max + 1 to avoid oom on oss-fuzzer */ sprintf(cfg_value, "%d", value); @@ -344,7 +353,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { std::vector<uint8_t>pkt = fuzzed_data.ConsumeRemainingBytes<uint8_t>(); ndpi_detection_process_packet(ndpi_info_mod, &flow, pkt.data(), pkt.size(), 0, &input_info); - p = ndpi_detection_giveup(ndpi_info_mod, &flow, 1, &protocol_was_guessed); + p = ndpi_detection_giveup(ndpi_info_mod, &flow, &protocol_was_guessed); assert(p.master_protocol == ndpi_get_flow_masterprotocol(ndpi_info_mod, &flow)); assert(p.app_protocol == ndpi_get_flow_appprotocol(ndpi_info_mod, &flow)); diff --git a/fuzz/fuzz_ndpi_reader.c b/fuzz/fuzz_ndpi_reader.c index 7733b690f..2c524a8ac 100644 --- a/fuzz/fuzz_ndpi_reader.c +++ b/fuzz/fuzz_ndpi_reader.c @@ -12,7 +12,7 @@ struct ndpi_workflow_prefs *prefs = NULL; struct ndpi_workflow *workflow = NULL; u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0; -u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0; +u_int8_t enable_payload_analyzer = 0; u_int8_t enable_flow_stats = 1; u_int8_t human_readeable_string_len = 5; u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */; diff --git a/fuzz/fuzz_process_packet.c b/fuzz/fuzz_process_packet.c index 3f0694cf9..2098f4fd1 100644 --- a/fuzz/fuzz_process_packet.c +++ b/fuzz/fuzz_process_packet.c @@ -23,7 +23,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ndpi_protocol detected_protocol = ndpi_detection_process_packet(ndpi_info_mod, &ndpi_flow, Data, Size, 0, NULL); ndpi_protocol guessed_protocol = - ndpi_detection_giveup(ndpi_info_mod, &ndpi_flow, 1, &protocol_was_guessed); + ndpi_detection_giveup(ndpi_info_mod, &ndpi_flow, &protocol_was_guessed); ndpi_reset_serializer(&json_serializer); ndpi_reset_serializer(&csv_serializer); diff --git a/fuzz/fuzz_readerutils_parseprotolist.cpp b/fuzz/fuzz_readerutils_parseprotolist.cpp index c80ae8340..f4e7f0485 100644 --- a/fuzz/fuzz_readerutils_parseprotolist.cpp +++ b/fuzz/fuzz_readerutils_parseprotolist.cpp @@ -6,10 +6,8 @@ #include <stdio.h> #include "fuzzer/FuzzedDataProvider.h" -char *_debug_protocols; -int nDPI_LogLevel = 0; u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0; -u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0; +u_int8_t enable_payload_analyzer = 0; u_int8_t enable_flow_stats = 0; u_int8_t human_readeable_string_len = 5; u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */; diff --git a/fuzz/fuzz_readerutils_workflow.cpp b/fuzz/fuzz_readerutils_workflow.cpp index ed5238f75..d4d747374 100644 --- a/fuzz/fuzz_readerutils_workflow.cpp +++ b/fuzz/fuzz_readerutils_workflow.cpp @@ -9,7 +9,7 @@ extern u_int8_t enable_doh_dot_detection; u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0; -u_int8_t enable_protocol_guess = 1, enable_payload_analyzer = 0; +u_int8_t enable_payload_analyzer = 0; u_int8_t enable_flow_stats = 0; u_int8_t human_readeable_string_len = 5; u_int8_t max_num_udp_dissected_pkts = 16 /* 8 is enough for most protocols, Signal requires more */, max_num_tcp_dissected_pkts = 80 /* due to telnet */; |