diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-10-11 02:24:09 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-10-18 22:53:30 +0200 |
commit | 77247ba07b0052e175dd60ae1db22e65007691eb (patch) | |
tree | f06fde161f64c97a9c8463ba14144f12fd88eaeb /src/lib/protocols/ntp.c | |
parent | b97dc6baa497b5c2d64e342108237ced6bf34b2c (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/ntp.c')
-rw-r--r-- | src/lib/protocols/ntp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/protocols/ntp.c b/src/lib/protocols/ntp.c index db9416121..1b56dc8a2 100644 --- a/src/lib/protocols/ntp.c +++ b/src/lib/protocols/ntp.c @@ -49,7 +49,7 @@ void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struc // 38 in binary representation is 00111000 flow->protos.ntp.version = (packet->payload[0] & 0x38) >> 3; - if (flow->protos.ntp.version == 2) { + if (packet->payload_packet_len > 3 && flow->protos.ntp.version == 2) { flow->protos.ntp.request_code = packet->payload[3]; } |