diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2022-01-27 10:59:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 10:59:35 +0100 |
commit | 9dcc4a2334fa10d7d0a3c019ee35dfde4c06e044 (patch) | |
tree | 35b2ab5ff342f5ea0398289bda1f8d8944190c5b /example | |
parent | 011ee3ecbd3ee98457fc58b454aa3d549910f280 (diff) |
Kerberos, TLS, example: fix some memory errors (#1419)
Detected by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43823
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43921
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43925
Diffstat (limited to 'example')
-rw-r--r-- | example/reader_util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index 136bef914..d47b5a5ec 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -2037,9 +2037,14 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, if(iph->version == 6) { iph6 = (struct ndpi_ipv6hdr *)&packet[ip_offset]; iph = NULL; + if(header->caplen < ip_offset + sizeof(struct ndpi_ipv6hdr)) + return(nproto); } else if(iph->version != IPVERSION) { // printf("WARNING: not good (packet_id=%u)!\n", (unsigned int)workflow->stats.raw_packet_count); goto v4_warning; + } else { + if(header->caplen < ip_offset + sizeof(struct ndpi_iphdr)) + return(nproto); } } } |