aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorLuca Deri <lucaderi@users.noreply.github.com>2020-02-15 17:21:52 +0100
committerGitHub <noreply@github.com>2020-02-15 17:21:52 +0100
commite0a058af6726a87009cca29759ce02dfdf0d04c6 (patch)
tree793fabccd66a8f13d671dd39cc9e6467007559b7 /example/reader_util.c
parent80e9826040bf9fb411a73fa7397e1f1870a07cd7 (diff)
parentbf7dcd63c3a663cd0e1e8c567511ccfd8047d24a (diff)
Merge pull request #844 from catenacyber/fuzz2fix
Fuzz2fix
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index ae132fcff..8b7f55fe4 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -676,6 +676,8 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
l3 = (const u_int8_t*)iph6;
}
+ if (ipsize < l4_offset + l4_packet_len)
+ return NULL;
*proto = iph->protocol;
@@ -1605,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 */