aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorPhilippe Antoine <contact@catenacyber.fr>2020-02-26 16:16:29 +0100
committerPhilippe Antoine <contact@catenacyber.fr>2020-02-26 16:16:29 +0100
commit83fdfe24d09396f293f6e78ecd341526f339a995 (patch)
treea8160d61b2f74a3efcaf690e10dfb42d10932ecc /example/reader_util.c
parentd4c093e828ea0d361b185627101c6ab7d319485e (diff)
Fix read overflow before UDP header
Diffstat (limited to 'example/reader_util.c')
-rw-r--r--example/reader_util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c
index 7ab060ef5..f56320976 100644
--- a/example/reader_util.c
+++ b/example/reader_util.c
@@ -1709,6 +1709,8 @@ ether_type_check:
}
if(workflow->prefs.decode_tunnels && (proto == IPPROTO_UDP)) {
+ if (header->caplen < ip_offset + ip_len + sizeof(struct ndpi_udphdr))
+ return(nproto); /* Too short for UDP header*/
struct ndpi_udphdr *udp = (struct ndpi_udphdr *)&packet[ip_offset+ip_len];
u_int16_t sport = ntohs(udp->source), dport = ntohs(udp->dest);