diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2020-02-08 11:20:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 11:20:54 +0100 |
commit | 33d761a55a0b259ae604d9c8ee528bf51e22d143 (patch) | |
tree | 6a95aee7060539ed8dc4cd4990aa7c66571a581c /example | |
parent | 2bd89be3e2ce52afcf105cdde2b0624f758ad638 (diff) | |
parent | 418ea234ae31ed9e9d9c60994d0c99022fc38a54 (diff) |
Merge pull request #838 from catenacyber/fix2
Adds missing checks
Diffstat (limited to 'example')
-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 ab3a73741..cc44296d7 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; } @@ -1515,6 +1518,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; |