aboutsummaryrefslogtreecommitdiff
path: root/example/reader_util.c
diff options
context:
space:
mode:
authorPhilippe Antoine <contact@catenacyber.fr>2020-04-15 15:50:58 +0200
committerPhilippe Antoine <contact@catenacyber.fr>2020-04-15 15:50:58 +0200
commitc1baf1516de5fc0cd122e4693f4774b0fd4b627b (patch)
tree7a387264781a26485479d5142a980fa96a0274fa /example/reader_util.c
parent369dc65c1a4af1176a5012ebb414d97e84b9f81d (diff)
Adds bound check for TZSP
Diffstat (limited to 'example/reader_util.c')
-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 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];