From c65c0479ec782cc8e34c52a3673db7fbd14e5076 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 3 Feb 2021 12:46:36 +0100 Subject: Added fuzzy targets conditional in tests/do.sh.in which prevents the fuzzer from running if nDPI was configured previously --enable-fuzztargets but not for the current config (may produce invalid results). * fixed possible NULL pointer dereference for memcpy(), src pointer should never be NULL Signed-off-by: Toni Uhlig --- src/lib/ndpi_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index 1e3170862..834399c04 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -136,8 +136,11 @@ void *ndpi_realloc(void *ptr, size_t old_size, size_t new_size) { if(!ret) return(ret); else { - memcpy(ret, ptr, old_size); - ndpi_free(ptr); + if (ptr != NULL) + { + memcpy(ret, ptr, old_size); + ndpi_free(ptr); + } return(ret); } } -- cgit v1.2.3