Adds missing checks

Found by fuzzing
This commit is contained in:
Philippe Antoine
2020-02-03 22:38:31 +01:00
parent 3e99b73635
commit 418ea234ae
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -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;