From c1baf1516de5fc0cd122e4693f4774b0fd4b627b Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Wed, 15 Apr 2020 15:50:58 +0200 Subject: Adds bound check for TZSP --- example/reader_util.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index 97aa940bd..e5aa7478b 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1745,6 +1745,9 @@ ether_type_check: } } else if((sport == TZSP_PORT) || (dport == TZSP_PORT)) { /* https://en.wikipedia.org/wiki/TZSP */ + if (header->caplen < ip_offset + ip_len + sizeof(struct ndpi_udphdr) + 4) + return(nproto); /* Too short for TZSP*/ + u_int offset = ip_offset+ip_len+sizeof(struct ndpi_udphdr); u_int8_t version = packet[offset]; u_int8_t ts_type = packet[offset+1]; -- cgit v1.2.3