From: Francois-Xavier Le Bail Date: Sat, 17 Oct 2020 12:01:14 +0000 (+0200) Subject: BRCMTAG: Use ND_TCHECK_LEN() for a bounds check X-Git-Tag: tcpdump-4.99-bp~96 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/59bf429d9bf238128cf8c12333860bc798d26614 BRCMTAG: Use ND_TCHECK_LEN() for a bounds check Moreover: Add a missing ndo_ll_hdr_len increment. Define ND_LONGJMP_FROM_TCHECK. --- diff --git a/print-brcmtag.c b/print-brcmtag.c index 1e0c5884..efc6a1ee 100644 --- a/print-brcmtag.c +++ b/print-brcmtag.c @@ -27,6 +27,7 @@ #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "ethertype.h" #include "addrtoname.h" @@ -131,11 +132,8 @@ brcm_tag_prepend_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, u_int length = h->len; ndo->ndo_protocol = "brcm-tag-prepend"; - if (caplen < BRCM_TAG_LEN) { - ndo->ndo_ll_hdr_len += caplen; - nd_print_trunc(ndo); - return; - } + ND_TCHECK_LEN(p, BRCM_TAG_LEN); + ndo->ndo_ll_hdr_len += BRCM_TAG_LEN; if (ndo->ndo_eflag) { /* Print the prepended Broadcom tag. */