From: Francois-Xavier Le Bail Date: Thu, 6 May 2021 11:39:10 +0000 (+0200) Subject: Ethernet: Add a bounds check X-Git-Tag: tcpdump-4.99.1~30 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/78f618d2c110489f95354198d4e9054214b1b880 Ethernet: Add a bounds check Avoid to have p (current pointer on packet data) > ndo->ndo_snapend in isoclns_print() in some cases. Moreover: Add a "FIXME" comment. (cherry picked from commit 7b7b84716e604abd8bd92cee75e6385cab6ce3dc) --- diff --git a/print-ether.c b/print-ether.c index 2596cd6d..da95862b 100644 --- a/print-ether.c +++ b/print-ether.c @@ -564,6 +564,9 @@ ethertype_print(netdissect_options *ndo, nd_print_trunc(ndo); return (1); } + /* At least one byte is required */ + /* FIXME: Reference for this byte? */ + ND_TCHECK_LEN(p, 1); isoclns_print(ndo, p + 1, length - 1); return(1);