diff options
-rw-r--r-- | example/reader_util.c | 7 | ||||
-rw-r--r-- | src/lib/protocols/telnet.c | 2 |
2 files changed, 9 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; diff --git a/src/lib/protocols/telnet.c b/src/lib/protocols/telnet.c index 0848ef467..dfccd904e 100644 --- a/src/lib/protocols/telnet.c +++ b/src/lib/protocols/telnet.c @@ -41,6 +41,8 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct, printf("==> %s() [%s][direction: %u]\n", __FUNCTION__, packet->payload, packet->packet_direction); #endif + if (packet->payload == NULL) + return(1); if(packet->payload[0] == 0xFF) return(1); |