aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/http.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-10-11 02:24:09 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-10-18 22:53:30 +0200
commit77247ba07b0052e175dd60ae1db22e65007691eb (patch)
treef06fde161f64c97a9c8463ba14144f12fd88eaeb /src/lib/protocols/http.c
parentb97dc6baa497b5c2d64e342108237ced6bf34b2c (diff)
Fix broken fuzz_process_packet fuzzer by adding a call to ndpi_finalize_initialization().fix/memory-errors-and-packet-fuzzer
* 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 <matzeton@googlemail.com>
Diffstat (limited to 'src/lib/protocols/http.c')
-rw-r--r--src/lib/protocols/http.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c
index 055726af0..854e6e81d 100644
--- a/src/lib/protocols/http.c
+++ b/src/lib/protocols/http.c
@@ -448,9 +448,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';