From: Francois-Xavier Le Bail Date: Sat, 5 Sep 2020 21:25:16 +0000 (+0200) Subject: Remove some now redundant ND_TCHECK_LEN(e, sizeof(nd_ipv6)) calls X-Git-Tag: tcpdump-4.99-bp~249 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/24df77f09e26a72f662a82b92645707e0572d1cc Remove some now redundant ND_TCHECK_LEN(e, sizeof(nd_ipv6)) calls They are redundant because they are followed by a GET_IP6ADDR_STRING(e) call, same e, which do the bounds check. Remove unused 'trunc' label(s) and associated code(s). --- diff --git a/print-bgp.c b/print-bgp.c index a8bb237c..b0326411 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -688,7 +688,6 @@ bgp_vpn_ip_print(netdissect_options *ndo, snprintf(pos, sizeof(addr), "%s", GET_IPADDR_STRING(pptr)); break; case (sizeof(nd_ipv6) << 3): /* 128 */ - ND_TCHECK_LEN(pptr, sizeof(nd_ipv6)); snprintf(pos, sizeof(addr), "%s", GET_IP6ADDR_STRING(pptr)); break; default: @@ -2168,7 +2167,6 @@ bgp_attr_print(netdissect_options *ndo, tlen -= tnhlen; tnhlen = 0; } else { - ND_TCHECK_LEN(tptr, sizeof(nd_ipv6)); ND_PRINT("%s", GET_IP6ADDR_STRING(tptr)); tptr += sizeof(nd_ipv6); tlen -= sizeof(nd_ipv6); diff --git a/print-icmp6.c b/print-icmp6.c index 85897303..24407904 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1596,7 +1596,6 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT(" [invalid number of groups]"); return; } - ND_TCHECK_LEN(bp + 4 + group, sizeof(nd_ipv6)); ND_PRINT(" [gaddr %s", GET_IP6ADDR_STRING(bp + group + 4)); ND_PRINT(" %s", tok2str(mldv2report2str, " [v2-report-#%u]", GET_U_1(bp + group))); @@ -1612,8 +1611,6 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) /* Print the sources */ ND_PRINT(" {"); for (j = 0; j < nsrcs; j++) { - ND_TCHECK_LEN(bp + group + 20 + (j * sizeof(nd_ipv6)), - sizeof(nd_ipv6)); ND_PRINT(" %s", GET_IP6ADDR_STRING(bp + group + 20 + (j * sizeof(nd_ipv6)))); } ND_PRINT(" }"); @@ -1623,10 +1620,6 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT("]"); } } - return; -trunc: - nd_print_trunc(ndo); - return; } static void @@ -1652,7 +1645,6 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) if (ndo->ndo_vflag) { ND_PRINT(" [max resp delay=%u]", mrt); } - ND_TCHECK_LEN(bp + 8, sizeof(nd_ipv6)); ND_PRINT(" [gaddr %s", GET_IP6ADDR_STRING(bp + 8)); if (ndo->ndo_vflag) { @@ -1679,8 +1671,6 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) else if (ndo->ndo_vflag > 1) { ND_PRINT(" {"); for (i = 0; i < nsrcs; i++) { - ND_TCHECK_LEN(bp + 28 + (i * sizeof(nd_ipv6)), - sizeof(nd_ipv6)); ND_PRINT(" %s", GET_IP6ADDR_STRING(bp + 28 + (i * sizeof(nd_ipv6)))); } ND_PRINT(" }"); diff --git a/print-isoclns.c b/print-isoclns.c index 1e381eb6..da155708 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -3110,8 +3110,6 @@ isis_print(netdissect_options *ndo, while (tlen != 0) { if (tlen < sizeof(nd_ipv6)) goto tlv_trunc; - ND_TCHECK_LEN(tptr, sizeof(nd_ipv6)); - ND_PRINT("\n\t IPv6 interface address: %s", GET_IP6ADDR_STRING(tptr)); diff --git a/print-ldp.c b/print-ldp.c index b5724450..282bed62 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -317,7 +317,6 @@ ldp_tlv_print(netdissect_options *ndo, break; case AFNUM_INET6: while(tlv_tlen >= sizeof(nd_ipv6)) { - ND_TCHECK_LEN(tptr, sizeof(nd_ipv6)); ND_PRINT(" %s", GET_IP6ADDR_STRING(tptr)); tlv_tlen-=sizeof(nd_ipv6); tptr+=sizeof(nd_ipv6);