diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-02-03 12:46:36 +0100 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-02-03 12:49:33 +0100 |
commit | c65c0479ec782cc8e34c52a3673db7fbd14e5076 (patch) | |
tree | 1ef254794598755b263e257ac61e4602ee49fc4e /src/lib/ndpi_main.c | |
parent | 6289413fea1e66230f195e36e3c38082c1e00a93 (diff) |
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).tiny-improvements
* fixed possible NULL pointer dereference for memcpy(), src pointer should never be NULL
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 7 |
1 files changed, 5 insertions, 2 deletions
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); } } |