From: Francois-Xavier Le Bail Date: Sun, 9 May 2021 17:48:01 +0000 (+0200) Subject: ZEP: Add a bounds check X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6f245276a2a24d673f2919e33476191781e20499 ZEP: Add a bounds check 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. --- diff --git a/print-zep.c b/print-zep.c index ac4e017c..e10ecb35 100644 --- a/print-zep.c +++ b/print-zep.c @@ -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; }