From ed51987e3a4838dd9aef27dfab2c0651f2f52836 Mon Sep 17 00:00:00 2001 From: Toni Date: Mon, 18 Oct 2021 23:16:32 +0200 Subject: Fix broken fuzz_process_packet fuzzer by adding a call to ndpi_finalize_initialization(). (#1334) * fixed several memory errors (heap-overflow, unitialized memory, etc) * ability to build fuzz_process_packet with a main() allowing to replay crash data generated with fuzz_process_packet by LLVMs libfuzzer * temporarily disable fuzzing if `tests/do.sh` executed with env FUZZY_TESTING_ENABLED=1 Signed-off-by: Toni Uhlig --- src/lib/protocols/http.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib/protocols/http.c') diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index e291bc908..bb5b38eed 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -466,9 +466,7 @@ int http_process_user_agent(struct ndpi_detection_module_struct *ndpi_struct, } if(flow->http.user_agent == NULL) { - int len = ua_ptr_len + 1; - - flow->http.user_agent = ndpi_malloc(len); + flow->http.user_agent = ndpi_malloc(ua_ptr_len + 1); if(flow->http.user_agent) { memcpy(flow->http.user_agent, (char*)ua_ptr, ua_ptr_len); flow->http.user_agent[ua_ptr_len] = '\0'; -- cgit v1.2.3