diff options
author | Philippe Antoine <contact@catenacyber.fr> | 2020-02-03 22:38:31 +0100 |
---|---|---|
committer | Philippe Antoine <contact@catenacyber.fr> | 2020-02-03 22:38:31 +0100 |
commit | 418ea234ae31ed9e9d9c60994d0c99022fc38a54 (patch) | |
tree | 0cc665805d8a41232f266abba55fec53aa8808b8 /example/reader_util.c | |
parent | 3e99b736358ca11c3ba3723a1282ffd3bfc760bd (diff) |
Adds missing checks
Found by fuzzing
Diffstat (limited to 'example/reader_util.c')
-rw-r--r-- | example/reader_util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index 2236f79d3..53013df0d 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -671,6 +671,9 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow l3 = (const u_int8_t*)iph; } else { l4_offset = sizeof(struct ndpi_ipv6hdr); + if(sizeof(struct ndpi_ipv6hdr) > ipsize) + return NULL; + l3 = (const u_int8_t*)iph6; } @@ -1495,6 +1498,10 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, return(nproto); } + if(header->caplen < eth_offset + radio_len + sizeof((struct ndpi_wifi_header)) { + return(nproto); + } + /* Calculate 802.11 header length (variable) */ wifi = (struct ndpi_wifi_header*)( packet + eth_offset + radio_len); fc = wifi->fc; |