]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IGMP: Remove all remaining ND_TCHECK*() cases.
authorDenis Ovsienko <[email protected]>
Wed, 30 Sep 2020 02:46:47 +0000 (03:46 +0100)
committerDenis Ovsienko <[email protected]>
Wed, 30 Sep 2020 13:52:46 +0000 (14:52 +0100)
In print_mtrace() the check was just before a GET that fetches the last
field of the structure. The other three checks tested exactly the space
from that GET_IPADDR_STRING() would fetch anyway.

print-igmp.c

index 771189945efbc50ea36a9a94e005cdbf083668ab..914e3d6b342cf646897d499f521a161650875de1 100644 (file)
@@ -114,7 +114,6 @@ print_mtrace(netdissect_options *ndo,
 {
     const struct tr_query *tr = (const struct tr_query *)(bp + 8);
 
 {
     const struct tr_query *tr = (const struct tr_query *)(bp + 8);
 
-    ND_TCHECK_SIZE(tr);
     if (len < 8 + sizeof (struct tr_query)) {
        ND_PRINT(" [invalid len %u]", len);
        return;
     if (len < 8 + sizeof (struct tr_query)) {
        ND_PRINT(" [invalid len %u]", len);
        return;
@@ -126,9 +125,6 @@ print_mtrace(netdissect_options *ndo,
         GET_IPADDR_STRING(tr->tr_raddr));
     if (IN_CLASSD(GET_BE_U_4(tr->tr_raddr)))
         ND_PRINT(" with-ttl %u", GET_U_1(tr->tr_rttl));
         GET_IPADDR_STRING(tr->tr_raddr));
     if (IN_CLASSD(GET_BE_U_4(tr->tr_raddr)))
         ND_PRINT(" with-ttl %u", GET_U_1(tr->tr_rttl));
-    return;
-trunc:
-    nd_print_trunc(ndo);
 }
 
 static void
 }
 
 static void
@@ -153,7 +149,6 @@ print_igmpv3_report(netdissect_options *ndo,
                ND_PRINT(" [invalid number of groups]");
                return;
            }
                ND_PRINT(" [invalid number of groups]");
                return;
            }
-           ND_TCHECK_4(bp + (group + 4));
             ND_PRINT(" [gaddr %s", GET_IPADDR_STRING(bp + group + 4));
            ND_PRINT(" %s", tok2str(igmpv3report2str, " [v3-report-#%u]",
                                                                GET_U_1(bp + group)));
             ND_PRINT(" [gaddr %s", GET_IPADDR_STRING(bp + group + 4));
            ND_PRINT(" %s", tok2str(igmpv3report2str, " [v3-report-#%u]",
                                                                GET_U_1(bp + group)));
@@ -169,7 +164,6 @@ print_igmpv3_report(netdissect_options *ndo,
                /* Print the sources */
                 ND_PRINT(" {");
                 for (j=0; j<nsrcs; j++) {
                /* Print the sources */
                 ND_PRINT(" {");
                 for (j=0; j<nsrcs; j++) {
-                   ND_TCHECK_4(bp + (group + 8 + (j << 2)));
                    ND_PRINT(" %s", GET_IPADDR_STRING(bp + group + 8 + (j << 2)));
                }
                 ND_PRINT(" }");
                    ND_PRINT(" %s", GET_IPADDR_STRING(bp + group + 8 + (j << 2)));
                }
                 ND_PRINT(" }");
@@ -179,9 +173,6 @@ print_igmpv3_report(netdissect_options *ndo,
            ND_PRINT("]");
         }
     }
            ND_PRINT("]");
         }
     }
-    return;
-trunc:
-    nd_print_trunc(ndo);
 }
 
 static void
 }
 
 static void
@@ -224,7 +215,6 @@ print_igmpv3_query(netdissect_options *ndo,
        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_4(bp + (12 + (i << 2)));
                ND_PRINT(" %s", GET_IPADDR_STRING(bp + 12 + (i << 2)));
            }
            ND_PRINT(" }");
                ND_PRINT(" %s", GET_IPADDR_STRING(bp + 12 + (i << 2)));
            }
            ND_PRINT(" }");
@@ -232,9 +222,6 @@ print_igmpv3_query(netdissect_options *ndo,
            ND_PRINT(", %u source(s)", nsrcs);
     }
     ND_PRINT("]");
            ND_PRINT(", %u source(s)", nsrcs);
     }
     ND_PRINT("]");
-    return;
-trunc:
-    nd_print_trunc(ndo);
 }
 
 void
 }
 
 void