From a38f788edf0df65f63c84241a4ac5f372c86c7dd Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Wed, 18 Nov 2020 21:11:59 +0100 Subject: [PATCH] Symantec: Use ND_TCHECK_LEN() for a bounds check Moreover: Define ND_LONGJMP_FROM_TCHECK. Remove a ndo_ll_hdr_len increment in a truncation case. --- print-symantec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/print-symantec.c b/print-symantec.c index 8fe0c79f..0d394e30 100644 --- a/print-symantec.c +++ b/print-symantec.c @@ -27,6 +27,7 @@ #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" #include "ethertype.h" @@ -78,11 +79,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ u_short ether_type; ndo->ndo_protocol = "symantec"; - if (caplen < sizeof (struct symantec_header)) { - ndo->ndo_ll_hdr_len += caplen; - nd_print_trunc(ndo); - return; - } + ND_TCHECK_LEN(p, sizeof(struct symantec_header)); ndo->ndo_ll_hdr_len += sizeof (struct symantec_header); if (ndo->ndo_eflag) -- 2.39.5