]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove some now redundant ND_TCHECK_LEN(e, sizeof(nd_ipv6)) calls
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 5 Sep 2020 21:25:16 +0000 (23:25 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 7 Sep 2020 21:03:09 +0000 (23:03 +0200)
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).

print-bgp.c
print-icmp6.c
print-isoclns.c
print-ldp.c

index a8bb237c1bad69be9a960bf0d5b7967b9fa35c52..b032641177d136fc79f0847f6d6e4b6cd25435ef 100644 (file)
@@ -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 */
         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:
         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 {
                         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);
                         ND_PRINT("%s", GET_IP6ADDR_STRING(tptr));
                         tptr += sizeof(nd_ipv6);
                         tlen -= sizeof(nd_ipv6);
index 8589730376f513ff3b85fa020887a14975ef2835..2440790452e82cdc5525094c7530d364beacfd96 100644 (file)
@@ -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_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)));
             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++) {
                /* 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(" }");
                    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("]");
         }
     }
            ND_PRINT("]");
         }
     }
-    return;
-trunc:
-    nd_print_trunc(ndo);
-    return;
 }
 
 static void
 }
 
 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);
     }
     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) {
     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++) {
        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(" }");
                ND_PRINT(" %s", GET_IP6ADDR_STRING(bp + 28 + (i * sizeof(nd_ipv6))));
            }
            ND_PRINT(" }");
index 1e381eb6d1c53d38b59bee6d55adcf7d6d04a70d..da155708ff08c6d7ef425d93a1eddc3f118bf0cc 100644 (file)
@@ -3110,8 +3110,6 @@ isis_print(netdissect_options *ndo,
            while (tlen != 0) {
                 if (tlen < sizeof(nd_ipv6))
                     goto tlv_trunc;
            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));
 
                 ND_PRINT("\n\t      IPv6 interface address: %s",
                       GET_IP6ADDR_STRING(tptr));
 
index b57244509373f810fd893c726d1ddaf9e5606c8e..282bed62f64b9430a5ad38d84bb931476108626e 100644 (file)
@@ -317,7 +317,6 @@ ldp_tlv_print(netdissect_options *ndo,
             break;
         case AFNUM_INET6:
            while(tlv_tlen >= sizeof(nd_ipv6)) {
             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);
                ND_PRINT(" %s", GET_IP6ADDR_STRING(tptr));
                tlv_tlen-=sizeof(nd_ipv6);
                tptr+=sizeof(nd_ipv6);