From: Francois-Xavier Le Bail Date: Mon, 27 Dec 2021 14:40:13 +0000 (+0100) Subject: Juniper: Report invalid packets as invalid, not truncated X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/705fa25c5f02ed90dc30a5d93c0e72acb53d0941 Juniper: Report invalid packets as invalid, not truncated Update the output of a test accordingly. --- diff --git a/print-juniper.c b/print-juniper.c index 7b4c492a..a068a6bf 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -1331,8 +1331,7 @@ juniper_parse_header(netdissect_options *ndo, /* sanity checks */ if (tlv_type == 0 || tlv_len == 0) break; - if (tlv_len+JUNIPER_EXT_TLV_OVERHEAD > extension_length) - goto trunc; + ND_LCHECK_U(extension_length, tlv_len + JUNIPER_EXT_TLV_OVERHEAD); if (ndo->ndo_vflag > 1) ND_PRINT("\n\t %s Extension TLV #%u, length %u, value ", @@ -1589,8 +1588,8 @@ juniper_parse_header(netdissect_options *ndo, ND_PRINT("hlen %u, proto 0x%04x, ", l2info->header_len, l2info->proto); return 1; /* everything went ok so far. continue parsing */ -trunc: - nd_print_trunc(ndo); +invalid: + nd_print_invalid(ndo); return 0; } #endif /* defined(DLT_JUNIPER_GGSN) || defined(DLT_JUNIPER_ES) || \ diff --git a/tests/juniper_header-heapoverflow.out b/tests/juniper_header-heapoverflow.out index 732d5709..f3e4641c 100644 --- a/tests/juniper_header-heapoverflow.out +++ b/tests/juniper_header-heapoverflow.out @@ -1 +1 @@ - 1 01:10:59.680304 [|juniper_ether] + 1 01:10:59.680304 [extension_length 48 < 50] (invalid)