]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ZEP: Add a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 9 May 2021 17:48:01 +0000 (19:48 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 9 May 2021 17:58:34 +0000 (19:58 +0200)
This avoids to have cp (current pointer on packet data) > ndo->ndo_snapend
in hex_and_ascii_print(), via ndo_default_print(), via ND_DEFAULTPRINT(),
in some cases.

print-zep.c

index ac4e017c0dbf6ff75841ff0ee59c79332a181153..e10ecb35771ac849f12674f9053f608f56270d2c 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 
 #include "extract.h"
@@ -166,6 +167,7 @@ zep_print(netdissect_options *ndo,
                /* Call 802.15.4 dissector. */
                ND_PRINT("\n\t");
                if (ieee802_15_4_print(ndo, bp, inner_len)) {
+                       ND_TCHECK_LEN(bp, len);
                        bp += len;
                        len = 0;
                }