From: Francois-Xavier Le Bail Date: Sun, 8 Oct 2017 09:57:19 +0000 (+0200) Subject: (for 4.9.3) LDP: Add some missing bounds checks X-Git-Tag: tcpdump-4.9.3~82 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/e5ec0d6b59b02423ef6a29544bca34b62745c180 (for 4.9.3) LDP: Add some missing bounds checks In ldp_tlv_print(), these problems were identified through code review. --- diff --git a/print-ldp.c b/print-ldp.c index afd943d0..e7f00c35 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -437,19 +437,24 @@ ldp_tlv_print(netdissect_options *ndo, switch(vc_info_tlv_type) { case LDP_FEC_MARTINI_IFPARM_MTU: + ND_TCHECK_16BITS(tptr + 2); ND_PRINT((ndo, ": %u", EXTRACT_16BITS(tptr+2))); break; case LDP_FEC_MARTINI_IFPARM_DESC: ND_PRINT((ndo, ": ")); - for (idx = 2; idx < vc_info_tlv_len; idx++) + for (idx = 2; idx < vc_info_tlv_len; idx++) { + ND_TCHECK_8BITS(tptr + idx); safeputchar(ndo, *(tptr + idx)); + } break; case LDP_FEC_MARTINI_IFPARM_VCCV: + ND_TCHECK_8BITS(tptr + 2); ND_PRINT((ndo, "\n\t\t Control Channels (0x%02x) = [%s]", *(tptr+2), bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", *(tptr+2)))); + ND_TCHECK_8BITS(tptr + 3); ND_PRINT((ndo, "\n\t\t CV Types (0x%02x) = [%s]", *(tptr+3), bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", *(tptr+3))));