aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Antoine <contact@catenacyber.fr>2020-02-14 14:18:31 +0100
committerPhilippe Antoine <contact@catenacyber.fr>2020-02-14 14:18:31 +0100
commitbf7dcd63c3a663cd0e1e8c567511ccfd8047d24a (patch)
tree26c462537e14857d8a4365750c29fe2d4b66ae43
parentb287dccecfecd32f114b043f395019eb3b000791 (diff)
Checks length for next ip header
-rw-r--r--example/reader_util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index eca4d12d5..8b7f55fe4 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1607,6 +1607,9 @@ ether_type_check:
iph_check:
/* Check and set IP header size and total packet length */
+ if (header->caplen < ip_offset + sizeof(struct ndpi_iphdr))
+ return(nproto); /* Too short for next IP header*/
+
iph = (struct ndpi_iphdr *) &packet[ip_offset];
/* just work on Ethernet packets that contain IP */