]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Remove 96 assorted ND_TCHECK calls.
authorDenis Ovsienko <[email protected]>
Tue, 8 Sep 2020 04:04:58 +0000 (05:04 +0100)
committerDenis Ovsienko <[email protected]>
Tue, 8 Sep 2020 04:04:58 +0000 (05:04 +0100)
Remove a number of instances that do not match common patterns and have
the only substantial effect on the code flow that a truncated packet
triggers "goto trunc" instead of longjmp(). (In a few cases this change
can increase the number of fields printed before giving up.)

38 files changed:
print-aoe.c
print-atm.c
print-bgp.c
print-bootp.c
print-chdlc.c
print-dccp.c
print-dvmrp.c
print-eap.c
print-egp.c
print-fr.c
print-geonet.c
print-hsrp.c
print-icmp6.c
print-ip6.c
print-ipx.c
print-isakmp.c
print-isoclns.c
print-juniper.c
print-loopback.c
print-msdp.c
print-nfs.c
print-olsr.c
print-openflow-1.0.c
print-ospf.c
print-ospf6.c
print-pgm.c
print-pim.c
print-ppp.c
print-pppoe.c
print-radius.c
print-resp.c
print-smb.c
print-stp.c
print-telnet.c
print-timed.c
print-udld.c
print-udp.c
print-vrrp.c

index 0915f3aff304946d131f701805ba9890e2af8ba7..a44333e93460eac01bc0ed1ed6d7630d8593e19b 100644 (file)
@@ -248,7 +248,6 @@ aoev1_mac_print(netdissect_options *ndo,
        if (len < AOEV1_MAC_ARG_LEN)
                goto invalid;
        /* Reserved */
-       ND_TCHECK_1(cp);
        cp += 1;
        /* MCmd */
        ND_PRINT("\n\tMCmd: %s",
@@ -267,14 +266,12 @@ aoev1_mac_print(netdissect_options *ndo,
        /* directives */
        for (i = 0; i < dircount; i++) {
                /* Reserved */
-               ND_TCHECK_1(cp);
                cp += 1;
                /* DCmd */
                ND_PRINT("\n\t DCmd: %s",
                         tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", GET_U_1(cp)));
                cp += 1;
                /* Ethernet Address */
-               ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
                ND_PRINT(", Ethernet Address: %s", GET_ETHERADDR_STRING(cp));
                cp += MAC_ADDR_LEN;
        }
@@ -309,7 +306,6 @@ aoev1_reserve_print(netdissect_options *ndo,
                goto invalid;
        /* addresses */
        for (i = 0; i < nmacs; i++) {
-               ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
                ND_PRINT("\n\tEthernet Address %u: %s", i, GET_ETHERADDR_STRING(cp));
                cp += MAC_ADDR_LEN;
        }
index 4e19366a2a41f25572f7412956addf52cbc0036c..434d901c98fd041b756ef00d7b5f450adc8c5964 100644 (file)
@@ -459,7 +459,6 @@ oam_print(netdissect_options *ndo,
     } oam_ptr;
 
     ndo->ndo_protocol = "oam";
-    ND_TCHECK_1(p + ATM_HDR_LEN_NOHEC + hec);
     cell_header = GET_BE_U_4(p + hec);
     cell_type = (GET_U_1((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f;
     func_type = GET_U_1((p + ATM_HDR_LEN_NOHEC + hec)) & 0x0f;
index b032641177d136fc79f0847f6d6e4b6cd25435ef..6f4d694b0e3d8a82a4efc6a2b58e44ba2fc049aa 100644 (file)
@@ -1159,7 +1159,6 @@ decode_multicast_vpn(netdissect_options *ndo,
     u_int addr_length, sg_length;
     u_int offset;
 
-    ND_TCHECK_2(pptr);
     route_type = GET_U_1(pptr);
     pptr++;
     route_length = GET_U_1(pptr);
@@ -1310,7 +1309,6 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
                 }
                 return plen + 2;
             }
-            ND_TCHECK_3(pptr);
             tlv_type = GET_U_1(pptr);
             pptr++;
             tlv_len = GET_BE_U_2(pptr);  /* length, in *bits* */
@@ -1583,8 +1581,6 @@ bgp_attr_get_as_size(netdissect_options *ndo,
      * each.
      */
     while (tptr < pptr + len) {
-        ND_TCHECK_1(tptr);
-
         /*
          * If we do not find a valid segment type, our guess might be wrong.
          */
@@ -2026,7 +2022,6 @@ bgp_attr_print(netdissect_options *ndo,
             ND_PRINT("invalid len");
             break;
         }
-        ND_TCHECK_8(tptr);
         ND_PRINT(" AS #%s, origin %s",
                   as_printf(ndo, astostr, sizeof(astostr), GET_BE_U_4(tptr)),
                   GET_IPADDR_STRING(tptr + 4));
@@ -2378,14 +2373,12 @@ bgp_attr_print(netdissect_options *ndo,
         switch (tunnel_type) {
         case BGP_PMSI_TUNNEL_PIM_SM: /* fall through */
         case BGP_PMSI_TUNNEL_PIM_BIDIR:
-            ND_TCHECK_8(tptr);
             ND_PRINT("\n\t      Sender %s, P-Group %s",
                       GET_IPADDR_STRING(tptr),
                       GET_IPADDR_STRING(tptr+4));
             break;
 
         case BGP_PMSI_TUNNEL_PIM_SSM:
-            ND_TCHECK_8(tptr);
             ND_PRINT("\n\t      Root-Node %s, P-Group %s",
                       GET_IPADDR_STRING(tptr),
                       GET_IPADDR_STRING(tptr+4));
@@ -2397,13 +2390,11 @@ bgp_attr_print(netdissect_options *ndo,
             break;
         case BGP_PMSI_TUNNEL_LDP_P2MP: /* fall through */
         case BGP_PMSI_TUNNEL_LDP_MP2MP:
-            ND_TCHECK_8(tptr);
             ND_PRINT("\n\t      Root-Node %s, LSP-ID 0x%08x",
                       GET_IPADDR_STRING(tptr),
                       GET_BE_U_4(tptr + 4));
             break;
         case BGP_PMSI_TUNNEL_RSVP_P2MP:
-            ND_TCHECK_8(tptr);
             ND_PRINT("\n\t      Extended-Tunnel-ID %s, P2MP-ID 0x%08x",
                       GET_IPADDR_STRING(tptr),
                       GET_BE_U_4(tptr + 4));
@@ -2421,9 +2412,6 @@ bgp_attr_print(netdissect_options *ndo,
         uint16_t length;
 
         while (tlen >= 3) {
-
-            ND_TCHECK_3(tptr);
-
             type = GET_U_1(tptr);
             length = GET_BE_U_2(tptr + 1);
             tptr += 3;
@@ -2544,7 +2532,6 @@ bgp_attr_print(netdissect_options *ndo,
         }
         ND_PRINT("\n\t    ");
         while (len != 0) {
-            ND_TCHECK_LEN(tptr, 12);
             ND_PRINT("%u:%u:%u%s",
                       GET_BE_U_4(tptr),
                       GET_BE_U_4(tptr + 4),
@@ -3030,7 +3017,6 @@ bgp_notification_print(netdissect_options *ndo,
          */
         if(bgpn_minor == BGP_NOTIFY_MINOR_CEASE_MAXPRFX && length >= BGP_NOTIFICATION_SIZE + 7) {
             tptr = dat + BGP_NOTIFICATION_SIZE;
-            ND_TCHECK_7(tptr);
             ND_PRINT(", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u",
                       tok2str(af_values, "Unknown", GET_BE_U_2(tptr)),
                       GET_BE_U_2(tptr),
index 8ffaf409dade05109385c295feb1a755f22105d0..a2f1929a37b443733bcdf2b9d500e7f0917e7d65 100644 (file)
@@ -290,7 +290,6 @@ bootp_print(netdissect_options *ndo,
        bp_htype = GET_U_1(bp->bp_htype);
        bp_hlen = GET_U_1(bp->bp_hlen);
        if (bp_htype == 1 && bp_hlen == 6 && bp_op == BOOTPREQUEST) {
-               ND_TCHECK_6(bp->bp_chaddr);
                ND_PRINT(" from %s", GET_ETHERADDR_STRING(bp->bp_chaddr));
        }
 
@@ -344,7 +343,6 @@ bootp_print(netdissect_options *ndo,
 
        /* Client's Ethernet address */
        if (bp_htype == 1 && bp_hlen == 6) {
-               ND_TCHECK_6(bp->bp_chaddr);
                ND_PRINT("\n\t  Client-Ethernet-Address %s", GET_ETHERADDR_STRING(bp->bp_chaddr));
        }
 
index 5d45074d33de2b5e84473c5b8bc4ed4969a3fc9f..e0accf9e8f8a49064b457f1de211a1bdd0df6e90 100644 (file)
@@ -60,7 +60,6 @@ chdlc_print(netdissect_options *ndo, const u_char *p, u_int length)
        ndo->ndo_protocol = "chdlc";
        if (length < CHDLC_HDRLEN)
                goto trunc;
-       ND_TCHECK_LEN(p, CHDLC_HDRLEN);
        proto = GET_BE_U_2(p + 2);
        if (ndo->ndo_eflag) {
                 ND_PRINT("%s, ethertype %s (0x%04x), length %u: ",
@@ -96,7 +95,6 @@ chdlc_print(netdissect_options *ndo, const u_char *p, u_int length)
                 /* is the fudge byte set ? lets verify by spotting ISO headers */
                 if (length < 2)
                     goto trunc;
-                ND_TCHECK_2(p);
                 if (GET_U_1(p + 1) == NLPID_CLNP ||
                     GET_U_1(p + 1) == NLPID_ESIS ||
                     GET_U_1(p + 1) == NLPID_ISIS)
index 7662a78d724e5492e8f889174d208eb0f2624290..8766f4432c8b32c08dda1f4a3b35530c5a011496 100644 (file)
@@ -252,16 +252,12 @@ static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp)
        uint64_t ackno;
 
        if (DCCPH_X(dh) != 0) {
-               ND_TCHECK_8(ackp);
                ackno = GET_BE_U_6(ackp + 2);
        } else {
-               ND_TCHECK_4(ackp);
                ackno = GET_BE_U_3(ackp + 1);
        }
 
        ND_PRINT("(ack=%" PRIu64 ") ", ackno);
-trunc:
-       return;
 }
 
 static u_int dccp_print_option(netdissect_options *, const u_char *, u_int);
index 93fef04a5ef8e4a15ead2f5109f43175c52038e2..8ed95a8d47ba5dc958f7adfb5839de4a223884fe 100644 (file)
@@ -122,7 +122,6 @@ dvmrp_print(netdissect_options *ndo,
                 * extract version from IGMP group address field
                 */
                bp -= 4;
-               ND_TCHECK_4(bp);
                major_version = GET_U_1(bp + 3);
                minor_version = GET_U_1(bp + 2);
                bp += 4;
@@ -174,7 +173,6 @@ print_report(netdissect_options *ndo,
                        ND_PRINT(" [|]");
                        return (0);
                }
-               ND_TCHECK_3(bp);
                mask = (uint32_t)0xff << 24 | GET_U_1(bp) << 16 |
                        GET_U_1(bp + 1) << 8 | GET_U_1(bp + 2);
                width = 1;
@@ -215,8 +213,6 @@ print_report(netdissect_options *ndo,
                } while (!done);
        }
        return (0);
-trunc:
-       return (-1);
 }
 
 static int
@@ -342,34 +338,25 @@ static int
 print_prune(netdissect_options *ndo,
             const u_char *bp)
 {
-       ND_TCHECK_LEN(bp, 12);
        ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
        bp += 8;
        ND_PRINT(" timer ");
        unsigned_relts_print(ndo, GET_BE_U_4(bp));
        return (0);
-trunc:
-       return (-1);
 }
 
 static int
 print_graft(netdissect_options *ndo,
             const u_char *bp)
 {
-       ND_TCHECK_8(bp);
        ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
        return (0);
-trunc:
-       return (-1);
 }
 
 static int
 print_graft_ack(netdissect_options *ndo,
                 const u_char *bp)
 {
-       ND_TCHECK_8(bp);
        ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
        return (0);
-trunc:
-       return (-1);
 }
index e2de4c1378dffbdb883dd00d76a1455e9ca67c8e..2ef9de5e0995a8016aad0370e335b92369210743 100644 (file)
@@ -221,7 +221,6 @@ eap_print(netdissect_options *ndo,
                 break;
 
             case EAP_TYPE_FAST:
-                ND_TCHECK_1(cp + 5);
                 ND_PRINT(" FASTv%u",
                        EAP_TTLS_VERSION(GET_U_1((cp + 5))));
                 ND_PRINT(" flags [%s] 0x%02x,",
index 6677343bdb798674dfba107800468844abd8432c..d1693bf4a61afb6927f73c66b5876d1fe3268f2b 100644 (file)
@@ -200,7 +200,6 @@ egpnr_print(netdissect_options *ndo,
                while (distances != 0) {
                        if (length < 2)
                                goto trunc;
-                       ND_TCHECK_2(cp);
                        ND_PRINT("%sd%u:", comma, GET_U_1(cp));
                        cp++;
                        comma = ", ";
@@ -223,7 +222,6 @@ egpnr_print(netdissect_options *ndo,
                                } else if (!IN_CLASSA(addr)) {
                                        if (length < 2)
                                                goto trunc;
-                                       ND_TCHECK_2(cp);
                                        addr |= ((uint32_t) GET_U_1(cp)) << 16;
                                        cp++;
                                        addr |= ((uint32_t) GET_U_1(cp)) << 8;
index bdabc999d2e6820781be17edd6bc14bbfd36e737..8b81a0f25b52360ad830d636adf4a9c5e0e2a41c 100644 (file)
@@ -613,7 +613,6 @@ frf15_print(netdissect_options *ndo,
 
     if (length < 2)
         goto trunc;
-    ND_TCHECK_2(p);
 
     flags = GET_U_1(p)&MFR_BEC_MASK;
     sequence_num = (GET_U_1(p)&0x1e)<<7 | GET_U_1(p + 1);
index 8efc9b51a10cf33c8d1c680ddfb7a2c251b1a775..bd2fa0561c26912dd644c2dbcc20007c1d214b53 100644 (file)
@@ -88,17 +88,13 @@ print_long_pos_vector(netdissect_options *ndo,
 {
        uint32_t lat, lon;
 
-       ND_TCHECK_LEN(bp, GEONET_ADDR_LEN);
        ND_PRINT("GN_ADDR:%s ", GET_LINKADDR_STRING(bp, LINKADDR_OTHER, GEONET_ADDR_LEN));
 
-       ND_TCHECK_8(bp + 12);
        lat = GET_BE_U_4(bp + 12);
        ND_PRINT("lat:%u ", lat);
        lon = GET_BE_U_4(bp + 16);
        ND_PRINT("lon:%u", lon);
        return (0);
-trunc:
-       return -1;
 }
 
 
index 7c7ad2182bf78295b27695ba456983a972d4e8e4..b4e02f5513659151643f869cf2cdfda7d0c35122 100644 (file)
@@ -104,7 +104,6 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len)
        ND_PRINT("HSRPv%u", version);
        if (version != 0)
                return;
-       ND_TCHECK_1(hp->hsrp_op_code);
        ND_PRINT("-");
        ND_PRINT("%s ",
                 tok2strary(op_code_str, "unknown (%u)", GET_U_1(hp->hsrp_op_code)));
index 2440790452e82cdc5525094c7530d364beacfd96..a61675f52db150b24d410685a4bf60c3c1eab552 100644 (file)
@@ -1648,7 +1648,6 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
     ND_PRINT(" [gaddr %s", GET_IP6ADDR_STRING(bp + 8));
 
     if (ndo->ndo_vflag) {
-        ND_TCHECK_1(bp + 25);
        if (GET_U_1(bp + 24) & 0x08) {
                ND_PRINT(" sflag");
        }
@@ -1678,10 +1677,6 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
                 ND_PRINT(", %u source(s)", nsrcs);
     }
     ND_PRINT("]");
-    return;
-trunc:
-    nd_print_trunc(ndo);
-    return;
 }
 
 static void
index 87c1b1a1c8d3452fc0a09832026953d01ca63891..672ed10428620299bc170f7cc08434d238d597df 100644 (file)
@@ -77,7 +77,6 @@ ip6_finddst(netdissect_options *ndo, nd_ipv6 *dst,
                         * the header, in units of 8 octets, excluding
                         * the first 8 octets.
                         */
-                       ND_TCHECK_2(cp);
                        advance = (GET_U_1(cp + 1) + 1) << 3;
                        nh = GET_U_1(cp);
                        break;
index 9609c7085c77dad2623a8c9f67e1ff2ac3ff4d3b..835d2463dcd5a739adc4312c341592f3e5cdc0cc 100644 (file)
@@ -239,7 +239,6 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length)
        if (length != 0) {
            if (length < 8)
                goto trunc;
-           ND_TCHECK_8(ipx);
            ND_PRINT(" %08x/%u.%u", GET_BE_U_4(ipx),
                         GET_BE_U_2(ipx + 4), GET_BE_U_2(ipx + 6));
        }
@@ -249,7 +248,6 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length)
        for (i = 0; i < 50 && length != 0; i++) {
            if (length < 8)
                goto trunc;
-           ND_TCHECK_8(ipx);
            ND_PRINT(" %08x/%u.%u", GET_BE_U_4(ipx),
                         GET_BE_U_2(ipx + 4), GET_BE_U_2(ipx + 6));
 
index 9a66274882a2da9555c4e3a5b82b70b02dea454b..76e7dce107756325790398969cef2d154718b53e 100644 (file)
@@ -3111,7 +3111,6 @@ isakmp_rfc3948_print(netdissect_options *ndo,
        if(length < 4) {
                goto trunc;
        }
-       ND_TCHECK_1(bp + 3);
 
        /*
         * see if this is an IKE packet
index da155708ff08c6d7ef425d93a1eddc3f118bf0cc..288c4b183ace5967c2cef7aacf1d9f8863463c3b 100644 (file)
@@ -964,7 +964,6 @@ clnp_print(netdissect_options *ndo,
                 ND_PRINT(", bad opts/li");
                 return (0);
             }
-            ND_TCHECK_2(pptr);
             op = GET_U_1(pptr);
             opli = GET_U_1(pptr + 1);
             pptr += 2;
@@ -1394,7 +1393,6 @@ esis_print(netdissect_options *ndo,
                 ND_PRINT(", bad opts/li");
                 return;
             }
-            ND_TCHECK_2(pptr);
             op = GET_U_1(pptr);
             opli = GET_U_1(pptr + 1);
             pptr += 2;
@@ -1494,7 +1492,6 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK_2(tptr);
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
 
@@ -1627,7 +1624,6 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
 
   while (len > 2)
   {
-    ND_TCHECK_2(tptr);
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
     tptr += 2;
@@ -2252,7 +2248,6 @@ isis_print_mtid(netdissect_options *ndo,
 {
     if (tlv_remaining < 2)
         goto trunc;
-    ND_TCHECK_2(tptr);
 
     ND_PRINT("%s%s",
            ident,
@@ -2300,7 +2295,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         }
         processed++;
     } else if (afi == AF_INET6) {
-        ND_TCHECK_2(tptr);
         status_byte=GET_U_1(tptr);
         bit_length=GET_U_1(tptr + 1);
         if (bit_length > 128) {
@@ -2357,7 +2351,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         ND_PRINT(" (%u)", sublen);   /* print out subTLV length */
 
         while (sublen>0) {
-            ND_TCHECK_2(tptr);
             subtlvtype=GET_U_1(tptr);
             subtlvlen=GET_U_1(tptr + 1);
             tptr+=2;
@@ -2380,7 +2373,6 @@ isis_print_router_cap_subtlv(netdissect_options *ndo, const uint8_t *tptr, uint8
     uint8_t subt, subl;
 
     while (tlen >= 2) {
-       ND_TCHECK_LEN(tptr, 2);
        subt = GET_U_1(tptr);
        subl = GET_U_1(tptr+1);
        tlen -= 2;
@@ -3210,7 +3202,6 @@ isis_print(netdissect_options *ndo,
         {
             if (tlen < 2)
                 goto tlv_trunc;
-            ND_TCHECK_2(tptr);
 
             ND_PRINT("\n\t       RES: %u, MTID(s): %u",
                     (GET_BE_U_2(tptr) >> 12),
@@ -3492,7 +3483,6 @@ isis_print(netdissect_options *ndo,
                 nd_print_invalid(ndo);
                 break;
             }
-            ND_TCHECK_5(tptr); /* router-id + flags */
             ND_PRINT("\n\t      Router-ID %s", GET_IPADDR_STRING(tptr));
             ND_PRINT(", Flags [%s]",
                     bittok2str(isis_tlv_router_capability_flags, "none", GET_U_1(tptr+4)));
index 0a26c8bc1e1f0430081b95e7d54d6de72505f54f..1560cee554dc7db0cc012b5075364779eb87f7c2 100644 (file)
@@ -1283,7 +1283,6 @@ juniper_parse_header(netdissect_options *ndo,
 
     l2info->length = h->len;
     l2info->caplen = h->caplen;
-    ND_TCHECK_4(p);
     l2info->flags = GET_U_1(p + 3);
     l2info->direction = GET_U_1(p + 3) & JUNIPER_BPF_PKT_IN;
 
index a90c293b015cd43e0950c92f475d3dda1c03024d..5b8f65a919a3e72f5d61120e37153632b613fdb8 100644 (file)
@@ -80,7 +80,6 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le
                        if (len < 8)
                                goto invalid;
                        /* forwarding address */
-                       ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
                        ND_PRINT(", forwarding address %s", GET_ETHERADDR_STRING(cp));
                        cp += MAC_ADDR_LEN;
                        /* data */
index 129313f8aa0debbf960ccaefe1018230c0ba3882..545f452a6671238a1f34d147d6ec2bac5ed6bab9 100644 (file)
@@ -36,7 +36,6 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length)
        unsigned int type, len;
 
        ndo->ndo_protocol = "msdp";
-       ND_TCHECK_3(sp);
        /* See if we think we're at the beginning of a compound packet */
        type = GET_U_1(sp);
        len = GET_BE_U_2(sp + 1);
@@ -44,7 +43,6 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length)
                goto trunc;     /* not really truncated, but still not decodable */
        ND_PRINT(" msdp:");
        while (length != 0) {
-               ND_TCHECK_3(sp);
                type = GET_U_1(sp);
                len = GET_BE_U_2(sp + 1);
                if (len > 1400 || ndo->ndo_vflag)
@@ -75,7 +73,6 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length)
                        break;
                case 2:
                        ND_PRINT(" SA-Request");
-                       ND_TCHECK_5(sp);
                        ND_PRINT(" for %s", GET_IPADDR_STRING(sp + 1));
                        break;
                case 4:
index a7218f25d071d95813b0560a23085aeb69685829..a83f1b541885efaa7f98ce1be92947e72e16b80f 100644 (file)
@@ -291,7 +291,6 @@ parse_sattr3(netdissect_options *ndo,
        sa3->sa_atimetype = GET_BE_U_4(dp);
        dp++;
        if (sa3->sa_atimetype == NFSV3SATTRTIME_TOCLIENT) {
-               ND_TCHECK_4(dp + 1);
                sa3->sa_atime.nfsv3_sec = GET_BE_U_4(dp);
                dp++;
                sa3->sa_atime.nfsv3_nsec = GET_BE_U_4(dp);
@@ -301,7 +300,6 @@ parse_sattr3(netdissect_options *ndo,
        sa3->sa_mtimetype = GET_BE_U_4(dp);
        dp++;
        if (sa3->sa_mtimetype == NFSV3SATTRTIME_TOCLIENT) {
-               ND_TCHECK_4(dp + 1);
                sa3->sa_mtime.nfsv3_sec = GET_BE_U_4(dp);
                dp++;
                sa3->sa_mtime.nfsv3_nsec = GET_BE_U_4(dp);
@@ -309,8 +307,6 @@ parse_sattr3(netdissect_options *ndo,
        }
 
        return dp;
-trunc:
-       return NULL;
 }
 
 static void
index d6e40927938588f7df26f3a0a8919300dd6c6802..93f979cdc3e0df81ca607182e48f417894fdb61c 100644 (file)
@@ -629,7 +629,6 @@ olsr_print(netdissect_options *ndo,
 
             if (msg_tlen < 4)
                 goto trunc;
-            ND_TCHECK_4(msg_data);
 
             name_entries = GET_BE_U_2(msg_data + 2);
             addr_size = 4;
@@ -656,7 +655,6 @@ olsr_print(netdissect_options *ndo,
 
                 if (msg_tlen < 4)
                     break;
-                ND_TCHECK_4(msg_data);
 
                 name_entry_type = GET_BE_U_2(msg_data);
                 name_entry_len = GET_BE_U_2(msg_data + 2);
index b2eb27d85432d5f6e0a92b4293874c89c4df377f..21a1cbe9f6676d00f012cb377f26a69de91764f4 100644 (file)
@@ -806,7 +806,6 @@ of10_bsn_message_print(netdissect_options *ndo,
                ND_PRINT(", index %u", GET_U_1(cp));
                cp += 1;
                /* pad */
-               ND_TCHECK_3(cp);
                cp += 3;
                /* mask */
                ND_TCHECK_4(cp);
@@ -1357,7 +1356,6 @@ of10_match_print(netdissect_options *ndo,
                ND_PRINT("%smatch dl_vlan_pcp %s", pfx, pcp_str(GET_U_1(cp)));
        cp += 1;
        /* pad1 */
-       ND_TCHECK_1(cp);
        cp += 1;
        /* dl_type */
        dl_type = GET_BE_U_2(cp);
@@ -1589,7 +1587,6 @@ of10_features_reply_print(netdissect_options *ndo,
        ND_PRINT(", n_tables %u", GET_U_1(cp));
        cp += 1;
        /* pad */
-       ND_TCHECK_3(cp);
        cp += 3;
        /* capabilities */
        ND_PRINT("\n\t capabilities 0x%08x", GET_BE_U_4(cp));
@@ -1602,10 +1599,6 @@ of10_features_reply_print(netdissect_options *ndo,
        cp += 4;
        /* ports */
        return of10_phy_ports_print(ndo, cp, ep, len - OF_SWITCH_FEATURES_LEN);
-
-trunc:
-       nd_print_trunc(ndo);
-       return ep;
 }
 
 /* [OF10] Section 5.3.3 */
@@ -1665,7 +1658,6 @@ of10_port_mod_print(netdissect_options *ndo,
        ND_PRINT("\n\t port_no %s", tok2str(ofpp_str, "%u", GET_BE_U_2(cp)));
        cp += 2;
        /* hw_addr */
-       ND_TCHECK_LEN(cp, MAC_ADDR_LEN);
        ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp));
        cp += MAC_ADDR_LEN;
        /* config */
@@ -1727,7 +1719,6 @@ of10_stats_request_print(netdissect_options *ndo,
                         tok2str(tableid_str, "%u", GET_U_1(cp)));
                cp += 1;
                /* pad */
-               ND_TCHECK_1(cp);
                cp += 1;
                /* out_port */
                ND_PRINT(", out_port %s",
@@ -1862,7 +1853,6 @@ of10_flow_stats_reply_print(netdissect_options *ndo,
                ND_PRINT(", hard_timeout %u", GET_BE_U_2(cp));
                cp += 2;
                /* pad2 */
-               ND_TCHECK_6(cp);
                cp += 6;
                /* cookie */
                ND_PRINT(", cookie 0x%016" PRIx64, GET_BE_U_8(cp));
@@ -1996,7 +1986,6 @@ of10_port_stats_reply_print(netdissect_options *ndo,
                        goto next_port;
                }
                /* pad */
-               ND_TCHECK_6(cp);
                cp += 6;
                /* rx_packets */
                ND_PRINT(", rx_packets %" PRIu64, GET_BE_U_8(cp));
@@ -2064,7 +2053,6 @@ of10_queue_stats_reply_print(netdissect_options *ndo,
                         tok2str(ofpp_str, "%u", GET_BE_U_2(cp)));
                cp += 2;
                /* pad */
-               ND_TCHECK_2(cp);
                cp += 2;
                /* queue_id */
                ND_PRINT(", queue_id %u", GET_BE_U_4(cp));
@@ -2217,7 +2205,6 @@ of10_flow_removed_print(netdissect_options *ndo,
                 tok2str(ofprr_str, "unknown (0x%02x)", GET_U_1(cp)));
        cp += 1;
        /* pad */
-       ND_TCHECK_1(cp);
        cp += 1;
        /* duration_sec */
        ND_PRINT(", duration_sec %u", GET_BE_U_4(cp));
@@ -2230,7 +2217,6 @@ of10_flow_removed_print(netdissect_options *ndo,
                ND_PRINT(", idle_timeout %u", GET_BE_U_2(cp));
        cp += 2;
        /* pad2 */
-       ND_TCHECK_2(cp);
        cp += 2;
        /* packet_count */
        ND_PRINT(", packet_count %" PRIu64, GET_BE_U_8(cp));
@@ -2238,10 +2224,6 @@ of10_flow_removed_print(netdissect_options *ndo,
        /* byte_count */
        ND_PRINT(", byte_count %" PRIu64, GET_BE_U_8(cp));
        return cp + 8;
-
-trunc:
-       nd_print_trunc(ndo);
-       return ep;
 }
 
 /* [OF10] Section 5.4.4 */
@@ -2257,7 +2239,6 @@ of10_error_print(netdissect_options *ndo,
        cp += 2;
        ND_PRINT("\n\t type %s", tok2str(ofpet_str, "invalid (0x%04x)", type));
        /* code */
-       ND_TCHECK_2(cp);
        code_str =
                type == OFPET_HELLO_FAILED    ? ofphfc_str  :
                type == OFPET_BAD_REQUEST     ? ofpbrc_str  :
@@ -2271,10 +2252,6 @@ of10_error_print(netdissect_options *ndo,
        cp += 2;
        /* data */
        return of10_data_print(ndo, cp, ep, len - OF_ERROR_MSG_LEN);
-
-trunc:
-       nd_print_trunc(ndo);
-       return ep;
 }
 
 const u_char *
index 8e4fec5ad238685aa809fa95fc3d7bf1fdb6c554..a0474a39157b33e3c781c25ee008fd3c012c9aae 100644 (file)
@@ -307,7 +307,6 @@ ospf_te_lsa_print(netdissect_options *ndo,
                            tlv_length);
                     return -1;
                 }
-                ND_TCHECK_4(tptr);
                 subtlv_type = GET_BE_U_2(tptr);
                 subtlv_length = GET_BE_U_2(tptr + 2);
                 tptr+=4;
@@ -941,7 +940,6 @@ ospf_decode_lls(netdissect_options *ndo,
     ND_PRINT(", length: %u", length2);
 
     dptr += 2;
-    ND_TCHECK_1(dptr);
     while (dptr < dataend) {
         lls_type = GET_BE_U_2(dptr);
         ND_PRINT("\n\t    %s (%u)",
@@ -977,8 +975,6 @@ ospf_decode_lls(netdissect_options *ndo,
     }
 
     return (0);
-trunc:
-    return (1);
 }
 
 static int
index 890ebf795f4f8ae2897ea9363c35ac04fe6cc9e2..01a35d56a661a5cbe8ebb73ba0125987a312ff62 100644 (file)
@@ -894,7 +894,6 @@ ospf6_decode_at(netdissect_options *ndo,
                goto trunc;
        cp += 2;
        /* Reserved */
-       ND_TCHECK_2(cp);
        cp += 2;
        /* Security Association ID */
        ND_PRINT(", SAID %u", GET_BE_U_2(cp));
index 0f88db6df12083e20d7769a2d0c1f12d1ac5c4b1..97ff0e10a47a6a7097c161f955624e80c38adb3f 100644 (file)
@@ -458,7 +458,6 @@ pgm_print(netdissect_options *ndo,
                    ND_PRINT("[Total option length leaves no room for final option]");
                    return;
                }
-               ND_TCHECK_2(bp);
                opt_type = GET_U_1(bp);
                bp++;
                opt_len = GET_U_1(bp);
index 4eacd04df35eed60c0e204a0e7ca1b0c1d18977f..1e63062e88d93177886b3d1c21be733c912749d6 100644 (file)
@@ -197,7 +197,6 @@ pimv1_join_prune_print(netdissect_options *ndo,
        len -= 4;
        if (len < 4)
                goto trunc;
-       ND_TCHECK_2(bp + 2);
        if (ndo->ndo_vflag > 1)
                ND_PRINT("\n");
        ND_PRINT(" Hold time: ");
@@ -209,7 +208,6 @@ pimv1_join_prune_print(netdissect_options *ndo,
 
        if (len < 4)
                goto trunc;
-       ND_TCHECK_4(bp);
        ngroups = GET_U_1(bp + 3);
        bp += 4;
        len -= 4;
@@ -233,7 +231,6 @@ pimv1_join_prune_print(netdissect_options *ndo,
                len -= 4;
                if (len < 4)
                        goto trunc;
-               ND_TCHECK_4(bp);
                njoin = GET_BE_U_2(bp);
                nprune = GET_BE_U_2(bp + 2);
                ND_PRINT(" joined: %u pruned: %u", njoin, nprune);
@@ -248,7 +245,6 @@ pimv1_join_prune_print(netdissect_options *ndo,
                                type = "Prune";
                        if (len < 6)
                                goto trunc;
-                       ND_TCHECK_6(bp);
                        ND_PRINT("\n\t%s %s%s%s%s/%u", type,
                            (GET_U_1(bp) & 0x01) ? "Sparse " : "Dense ",
                            (GET_U_1(bp + 1) & 0x80) ? "WC " : "",
@@ -443,7 +439,6 @@ cisco_autorp_print(netdissect_options *ndo,
                while (nentries != 0) {
                        if (len < 6)
                                goto trunc;
-                       ND_TCHECK_6(bp);
                        ND_PRINT("%c%s%s/%u", s, GET_U_1(bp) & 1 ? "!" : "",
                                  GET_IPADDR_STRING(bp + 2), GET_U_1(bp + 1));
                        if (GET_U_1(bp) & 0x02) {
@@ -577,7 +572,6 @@ pimv2_addr_print(netdissect_options *ndo,
        if (addr_len == 0) {
                if (len < 2)
                        goto trunc;
-               ND_TCHECK_1(bp + 1);
                switch (GET_U_1(bp)) {
                case 1:
                        af = AF_INET;
@@ -719,7 +713,6 @@ pimv2_print(netdissect_options *ndo,
                nd_print_invalid(ndo);
                return;
        }
-       ND_TCHECK_1(pim->pim_rsv);
        pim_typever = GET_U_1(pim->pim_typever);
        /* RFC5015 allocates the high 4 bits of pim_rsv for "subtype". */
        pimv2_addr_len = GET_U_1(pim->pim_rsv) & 0x0f;
@@ -781,7 +774,6 @@ pimv2_print(netdissect_options *ndo,
                while (len > 0) {
                        if (len < 4)
                                goto trunc;
-                       ND_TCHECK_4(bp);
                        otype = GET_BE_U_2(bp);
                        olen = GET_BE_U_2(bp + 2);
                        ND_PRINT("\n\t  %s Option (%u), length %u, Value: ",
@@ -919,7 +911,6 @@ pimv2_print(netdissect_options *ndo,
                if (len == 0)
                        goto trunc;
                ip = (const struct ip *)bp;
-               ND_TCHECK_1(ip->ip_vhl);
                switch (IP_V(ip)) {
                 case 0: /* Null header */
                        ND_TCHECK_4(ip->ip_dst);
index 87003c3e09f99b110dfa9ff6cb378b8e12423fce..759b06b118ec15bd85e0108f8e6c1455b270e2dc 100644 (file)
@@ -739,7 +739,6 @@ print_lcp_config_options(netdissect_options *ndo,
                                ND_PRINT(" (length bogus, should be = 9)");
                                return 0;
                        }
-                       ND_TCHECK_6(p + 3);
                        ND_PRINT(": MAC %s", GET_ETHERADDR_STRING(p + 3));
                        break;
                case MEDCLASS_MNB:
index 9452b19eeef6b8319d32d6c2c607d4c280e5c74f..50ae0996af72e1df251b65ff37b484063d32a4c5 100644 (file)
@@ -150,7 +150,6 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length)
                 * tag_type is previous tag or 0xffff for first iteration
                 */
                while (tag_type && p < pppoe_payload + pppoe_length) {
-                       ND_TCHECK_4(p);
                        tag_type = GET_BE_U_2(p);
                        tag_len = GET_BE_U_2(p + 2);
                        p += 4;
index 4c18651067d214093e6c27c4912c5fc720eb89c9..1e5c610e700745e90264c949bb20c447c1edca15 100644 (file)
@@ -854,8 +854,6 @@ print_vendor_attr(netdissect_options *ndo,
            vendor_id);
 
     while (length >= 2) {
-       ND_TCHECK_2(data);
-
         vendor_type = GET_U_1(data);
         vendor_length = GET_U_1(data + 1);
 
@@ -910,7 +908,6 @@ print_attr_num(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_4(data);
                           /* This attribute has standard values */
    if (attr_type[attr_code].siz_subtypes)
    {
@@ -1007,11 +1004,6 @@ print_attr_num(netdissect_options *ndo,
       } /* switch */
 
    } /* if-else */
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 /*****************************/
@@ -1031,8 +1023,6 @@ print_attr_address(netdissect_options *ndo,
        return;
    }
 
-   ND_TCHECK_4(data);
-
    switch(attr_code)
    {
       case FRM_IPADDR:
@@ -1050,11 +1040,6 @@ print_attr_address(netdissect_options *ndo,
           ND_PRINT("%s", GET_IPADDR_STRING(data));
       break;
    }
-
-   return;
-
-   trunc:
-     nd_print_trunc(ndo);
 }
 
 /*****************************/
index 14fb6116f98d2e355fcde4b0435e0f206d67a845..38351e68d1e403b6013d757b97c198129b765241 100644 (file)
@@ -465,7 +465,6 @@ resp_get_length(netdissect_options *ndo, const u_char *bp, int len, const u_char
 
     if (len == 0)
         goto trunc;
-    ND_TCHECK_1(bp);
     too_large = 0;
     neg = 0;
     if (GET_U_1(bp) == '-') {
index 296f65153bed8739812e7b57bd50f9b81e96d851..bcd7363dec955c22a7cb42db4ee8bdd2d26f7fb0 100644 (file)
@@ -1085,7 +1085,6 @@ nbt_udp137_print(netdissect_options *ndo,
     u_int total, i;
 
     ndo->ndo_protocol = "nbt_udp137";
-    ND_TCHECK_2(data + 10);
     name_trn_id = GET_BE_U_2(data);
     response = (GET_U_1(data + 2) >> 7);
     opcode = (GET_U_1(data + 2) >> 3) & 0xF;
index 740f5ec730173bc5069e089d2533cfc6bdca671e..fa503935510f61174a05d30f0ae29bc039ce5317 100644 (file)
@@ -119,7 +119,6 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
         return 1;
     }
 
-    ND_TCHECK_2(stp_bpdu->forward_delay);
     ND_PRINT("\n\tmessage-age %.2fs, max-age %.2fs"
            ", hello-time %.2fs, forwarding-delay %.2fs",
            (float) GET_BE_U_2(stp_bpdu->message_age) / STP_TIME_BASE,
@@ -138,9 +137,6 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
                        RSTP_EXTRACT_PORT_ROLE(bpdu_flags)));
     }
     return 1;
-
-trunc:
-    return 0;
 }
 
 /*
@@ -275,7 +271,6 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
 
     ND_PRINT("CIST port-id %04x,", GET_BE_U_2(stp_bpdu->port_id));
 
-    ND_TCHECK_2(stp_bpdu->forward_delay);
     ND_PRINT("\n\tmessage-age %.2fs, max-age %.2fs"
            ", hello-time %.2fs, forwarding-delay %.2fs",
            (float) GET_BE_U_2(stp_bpdu->message_age) / STP_TIME_BASE,
index 5b2a785ec1f472acd2ca795503565b15e2d43149..817d4226855d4d62f9621cbc063fcbbe433d22c5 100644 (file)
@@ -437,7 +437,6 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
                /* IAC SB .... IAC SE */
                p = sp;
                while (length > (u_int)(p + 1 - sp)) {
-                       ND_TCHECK_2(p);
                        if (GET_U_1(p) == IAC && GET_U_1(p + 1) == SE)
                                break;
                        p++;
@@ -497,8 +496,6 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
 done:
        return (int)(sp - osp);
 
-trunc:
-       nd_print_trunc(ndo);
 pktend:
        return -1;
 #undef FETCH
index 2c00427111a867981559df250e3624b67053127f..ae8d576634fd6f7560adb806745280d359937f93 100644 (file)
@@ -116,7 +116,6 @@ timed_print(netdissect_options *ndo,
        case TSP_ADJTIME:
        case TSP_SETDATE:
        case TSP_SETDATEREQ:
-               ND_TCHECK_8(&tsp->tsp_time);
                sec = GET_BE_S_4(tsp->tsp_time.tv_sec);
                usec = GET_BE_S_4(tsp->tsp_time.tv_usec);
                /* XXX The comparison below is always false? */
index 543e6582cc350aec8441501db6f26b8fd2c8ef22..52ed7eff9f5d4117ec9a07bf98df7282d55d1c0d 100644 (file)
@@ -129,7 +129,6 @@ udld_print(netdissect_options *ndo, const u_char *pptr, u_int length)
 
     while (tptr < (pptr+length)) {
 
-        ND_TCHECK_4(tptr);
        type = GET_BE_U_2(tptr);
         len  = GET_BE_U_2(tptr + 2);
 
index 1db9bed96645aed9a9e9f3832a6aeeffcff6c521..151b7e6b6872b323d7da1402d17dc897a564436a 100644 (file)
@@ -103,7 +103,6 @@ vat_print(netdissect_options *ndo, const u_char *hdr, u_int length)
                ND_PRINT("udp/va/vat, length %u < 2", length);
                return;
        }
-       ND_TCHECK_2((const u_int *)hdr);
        ts = GET_BE_U_2(hdr);
        if ((ts & 0xf060) != 0) {
                /* probably vt */
@@ -130,10 +129,6 @@ vat_print(netdissect_options *ndo, const u_char *hdr, u_int length)
                if (i0 & 0x3f000000)
                        ND_PRINT(" s%u", (i0 >> 24) & 0x3f);
        }
-       return;
-
-trunc:
-       nd_print_trunc(ndo);
 }
 
 static void
index b795a3394485ca1a2553201b32e4dda97936b74d..49f42480edaafb4dc1c058e1f5ff1dd76b5d3108 100644 (file)
@@ -161,7 +161,6 @@ vrrp_print(netdissect_options *ndo,
                c = ' ';
                bp += 8;
                for (i = 0; i < naddrs; i++) {
-                       ND_TCHECK_1(bp + 3);
                        ND_PRINT("%c%s", c, GET_IPADDR_STRING(bp));
                        c = ',';
                        bp += 4;