From bf7dcd63c3a663cd0e1e8c567511ccfd8047d24a Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 14 Feb 2020 14:18:31 +0100 Subject: Checks length for next ip header --- example/reader_util.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'example') 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 */ -- cgit v1.2.3