]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Replace ND_TTEST2()/ND_TCHECK2() macros by macros using pointers (1/n)
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 11 Dec 2017 11:46:51 +0000 (12:46 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Mon, 11 Dec 2017 21:11:01 +0000 (22:11 +0100)
ND_TTEST2(var, l)  -> ND_TTEST_LEN(p, l)
ND_TCHECK2(var, l) -> ND_TCHECK_LEN(p, l)

87 files changed:
netdissect.h
print-802_11.c
print-ah.c
print-ahcp.c
print-aoe.c
print-arp.c
print-atalk.c
print-babel.c
print-beep.c
print-bfd.c
print-bgp.c
print-bootp.c
print-carp.c
print-cdp.c
print-cfm.c
print-chdlc.c
print-dccp.c
print-decnet.c
print-dhcp6.c
print-domain.c
print-dtp.c
print-dvmrp.c
print-eap.c
print-egp.c
print-eigrp.c
print-fr.c
print-geneve.c
print-geonet.c
print-hncp.c
print-icmp.c
print-icmp6.c
print-igmp.c
print-igrp.c
print-ip.c
print-ip6opts.c
print-ipx.c
print-isakmp.c
print-isoclns.c
print-juniper.c
print-krb.c
print-l2tp.c
print-ldp.c
print-lisp.c
print-llc.c
print-lldp.c
print-lmp.c
print-loopback.c
print-lspping.c
print-lwapp.c
print-lwres.c
print-m3ua.c
print-mpcp.c
print-mpls.c
print-nfs.c
print-nsh.c
print-ntp.c
print-olsr.c
print-openflow-1.0.c
print-openflow.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-rpki-rtr.c
print-rsvp.c
print-rx.c
print-sctp.c
print-sflow.c
print-slow.c
print-snmp.c
print-stp.c
print-tcp.c
print-udld.c
print-udp.c
print-vqp.c
print-vrrp.c
print-vtp.c
print-vxlan-gpe.c
print-vxlan.c
print-wb.c
print-zeromq.c
signature.c
smbutil.c

index 4c98164aa952409a7c5a0465872be24eee3f66d6..e306684322618465473a6ce0811613e05cdf149f 100644 (file)
@@ -326,12 +326,19 @@ struct netdissect_options {
        ((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \
          (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l)))
 
+#define ND_TTEST_LEN(p, l) \
+  (IS_NOT_NEGATIVE(l) && \
+       ((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \
+         (uintptr_t)(p) <= (uintptr_t)ndo->ndo_snapend - (l)))
+
 /* True if "var" was captured */
 #define ND_TTEST(var) ND_TTEST2(var, sizeof(var))
 
 /* Bail if "l" bytes of "var" were not captured */
 #define ND_TCHECK2(var, l) if (!ND_TTEST2(var, l)) goto trunc
 
+#define ND_TCHECK_LEN(p, l) if (!ND_TTEST_LEN(p, l)) goto trunc
+
 /* Bail if "var" was not captured */
 #define ND_TCHECK(var) ND_TCHECK2(var, sizeof(var))
 
index 17e128d97f9c57a161fc6725986825cc371ed47e..2d8b16e934fed85d6db027e40ebed3751e42cf59 100644 (file)
@@ -984,7 +984,7 @@ wep_print(netdissect_options *ndo,
 {
        uint32_t iv;
 
-       if (!ND_TTEST2(*p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_IV_LEN + IEEE802_11_KID_LEN))
                return 0;
        iv = EXTRACT_LE_U_4(p);
 
@@ -1026,7 +1026,7 @@ parse_elements(netdissect_options *ndo,
                elementlen = EXTRACT_U_1(p + offset + 1);
 
                /* Make sure we have the entire element. */
-               if (!ND_TTEST2(*(p + offset + 2), elementlen))
+               if (!ND_TTEST_LEN(p + offset + 2, elementlen))
                        return 0;
                if (length < elementlen + 2)
                        return 0;
@@ -1221,8 +1221,7 @@ handle_beacon(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
-           IEEE802_11_CAPINFO_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN + IEEE802_11_CAPINFO_LEN))
                return 0;
        if (length < IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
            IEEE802_11_CAPINFO_LEN)
@@ -1258,7 +1257,7 @@ handle_assoc_request(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN))
                return 0;
        if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN)
                return 0;
@@ -1286,8 +1285,7 @@ handle_assoc_response(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
-           IEEE802_11_AID_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN + IEEE802_11_AID_LEN))
                return 0;
        if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_STATUS_LEN +
            IEEE802_11_AID_LEN)
@@ -1323,8 +1321,7 @@ handle_reassoc_request(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
-           IEEE802_11_AP_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN + IEEE802_11_AP_LEN))
                return 0;
        if (length < IEEE802_11_CAPINFO_LEN + IEEE802_11_LISTENINT_LEN +
            IEEE802_11_AP_LEN)
@@ -1383,8 +1380,7 @@ handle_probe_response(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
-           IEEE802_11_CAPINFO_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN + IEEE802_11_CAPINFO_LEN))
                return 0;
        if (length < IEEE802_11_TSTAMP_LEN + IEEE802_11_BCNINT_LEN +
            IEEE802_11_CAPINFO_LEN)
@@ -1423,7 +1419,7 @@ handle_disassoc(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_REASON_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_REASON_LEN))
                return 0;
        if (length < IEEE802_11_REASON_LEN)
                return 0;
@@ -1500,7 +1496,7 @@ handle_deauth(netdissect_options *ndo,
 
        memset(&pbody, 0, sizeof(pbody));
 
-       if (!ND_TTEST2(*p, IEEE802_11_REASON_LEN))
+       if (!ND_TTEST_LEN(p, IEEE802_11_REASON_LEN))
                return 0;
        if (length < IEEE802_11_REASON_LEN)
                return 0;
@@ -1670,7 +1666,7 @@ ctrl_body_print(netdissect_options *ndo,
                /* XXX - requires special handling */
                break;
        case CTRL_BAR:
-               if (!ND_TTEST2(*p, CTRL_BAR_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_BAR_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ",
@@ -1680,48 +1676,48 @@ ctrl_body_print(netdissect_options *ndo,
                            EXTRACT_LE_U_2(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
                break;
        case CTRL_BA:
-               if (!ND_TTEST2(*p, CTRL_BA_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_BA_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s ",
                            etheraddr_string(ndo, ((const struct ctrl_ba_hdr_t *)p)->ra)));
                break;
        case CTRL_PS_POLL:
-               if (!ND_TTEST2(*p, CTRL_PS_POLL_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_PS_POLL_HDRLEN))
                        return 0;
                ND_PRINT((ndo, " AID(%x)",
                    EXTRACT_LE_U_2(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid))));
                break;
        case CTRL_RTS:
-               if (!ND_TTEST2(*p, CTRL_RTS_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_RTS_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " TA:%s ",
                            etheraddr_string(ndo, ((const struct ctrl_rts_hdr_t *)p)->ta)));
                break;
        case CTRL_CTS:
-               if (!ND_TTEST2(*p, CTRL_CTS_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_CTS_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s ",
                            etheraddr_string(ndo, ((const struct ctrl_cts_hdr_t *)p)->ra)));
                break;
        case CTRL_ACK:
-               if (!ND_TTEST2(*p, CTRL_ACK_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_ACK_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s ",
                            etheraddr_string(ndo, ((const struct ctrl_ack_hdr_t *)p)->ra)));
                break;
        case CTRL_CF_END:
-               if (!ND_TTEST2(*p, CTRL_END_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_END_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s ",
                            etheraddr_string(ndo, ((const struct ctrl_end_hdr_t *)p)->ra)));
                break;
        case CTRL_END_ACK:
-               if (!ND_TTEST2(*p, CTRL_END_ACK_HDRLEN))
+               if (!ND_TTEST_LEN(p, CTRL_END_ACK_HDRLEN))
                        return 0;
                if (!ndo->ndo_eflag)
                        ND_PRINT((ndo, " RA:%s ",
index 6f1a357cf227e23660cd0f879f49612de9e8eee0..307fe0d35de043f6ea46ee330e77451646a47046 100644 (file)
@@ -51,7 +51,7 @@ ah_print(netdissect_options *ndo, register const u_char *bp)
                ND_PRINT((ndo, ",sumlen=%d", sumlen));
        ND_TCHECK_4(ah + 1);
        ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_U_4(ah + 1)));
-       if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) {
+       if (!ND_TTEST_LEN(bp, sizeof(struct ah) + sumlen)) {
                ND_PRINT((ndo, "[truncated]):"));
                return -1;
        }
index efe684a0afac8895dd5efa0bdfaff5930f2df8ef..8d784c14105a0a6c0bc8e1f8dd374eeb99fbf405 100644 (file)
@@ -118,7 +118,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -136,7 +136,7 @@ ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -160,7 +160,7 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -184,7 +184,7 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -199,7 +199,7 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
        while (cp < ep) {
                if (cp + 17 > ep)
                        goto invalid;
-               ND_TCHECK2(*cp, 17);
+               ND_TCHECK_LEN(cp, 17);
                ND_PRINT((ndo, "%s%s/%u", sep, ip6addr_string(ndo, cp), EXTRACT_U_1(cp + 16)));
                cp += 17;
                sep = ", ";
@@ -208,7 +208,7 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -232,7 +232,7 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return 0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -285,7 +285,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
                                break; /* truncated and already marked up */
                } else {
                        ND_PRINT((ndo, " (Length %u)", option_len));
-                       ND_TCHECK2(*cp, option_len);
+                       ND_TCHECK_LEN(cp, option_len);
                }
                cp += option_len;
        }
@@ -293,7 +293,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -333,12 +333,12 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
        if (ndo->ndo_vflag >= 2)
                ahcp1_options_print(ndo, cp, cp + body_len); /* not ep (ignore extra data) */
        else
-               ND_TCHECK2(*cp, body_len);
+               ND_TCHECK_LEN(cp, body_len);
        return;
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -368,7 +368,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
                        if (len < AHCP1_HEADER_FIX_LEN)
                                goto invalid;
                        if (!ndo->ndo_vflag) {
-                               ND_TCHECK2(*cp, AHCP1_HEADER_FIX_LEN - 2);
+                               ND_TCHECK_LEN(cp, AHCP1_HEADER_FIX_LEN - 2);
                                cp += AHCP1_HEADER_FIX_LEN - 2;
                        } else {
                                /* Hopcount */
@@ -404,7 +404,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
index e5fe731935fec477874d17cd86dabce795dfa5fb..01f485dd90cde433151f8228810ed3d36e9bfb1f 100644 (file)
@@ -197,7 +197,7 @@ aoev1_issue_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -236,7 +236,7 @@ aoev1_query_print(netdissect_options *ndo,
        if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len)
                goto invalid;
        /* Config String */
-       ND_TCHECK2(*cp, cslen);
+       ND_TCHECK_LEN(cp, cslen);
        if (cslen) {
                ND_PRINT((ndo, "\n\tConfig String (length %u): ", cslen));
                if (fn_printn(ndo, cp, cslen, ndo->ndo_snapend))
@@ -246,7 +246,7 @@ aoev1_query_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -289,7 +289,7 @@ aoev1_mac_print(netdissect_options *ndo,
                ND_PRINT((ndo, "\n\t DCmd: %s", tok2str(aoev1_dcmd_str, "Unknown (0x%02x)", EXTRACT_U_1(cp))));
                cp += 1;
                /* Ethernet Address */
-               ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+               ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
                ND_PRINT((ndo, ", Ethernet Address: %s", etheraddr_string(ndo, cp)));
                cp += ETHER_ADDR_LEN;
        }
@@ -297,7 +297,7 @@ aoev1_mac_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -332,7 +332,7 @@ aoev1_reserve_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -390,7 +390,7 @@ aoev1_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -422,7 +422,7 @@ aoe_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
index dc8bf23f3ea384091935e04629e17dae7e59cc53..37320a84b6dd57b1e5d4dbfa9a220cd9a14f6b00 100644 (file)
@@ -266,7 +266,7 @@ atmarp_print(netdissect_options *ndo,
        pro = ATMPRO(ap);
        op = ATMOP(ap);
 
-       if (!ND_TTEST2(*aar_tpa(ap), ATMTPROTO_LEN(ap))) {
+       if (!ND_TTEST_LEN(aar_tpa(ap), ATMTPROTO_LEN(ap))) {
                ND_PRINT((ndo, "%s", tstr));
                ND_DEFAULTPRINT((const u_char *)ap, length);
                return;
@@ -385,7 +385,7 @@ arp_print(netdissect_options *ndo,
             break;
        }
 
-       if (!ND_TTEST2(*TPA(ap), PROTO_LEN(ap))) {
+       if (!ND_TTEST_LEN(TPA(ap), PROTO_LEN(ap))) {
                ND_PRINT((ndo, "%s", tstr));
                ND_DEFAULTPRINT((const u_char *)ap, length);
                return;
index ce61a44c9de18802a83d62b5b40c39b0ed274e36..f8f95de4d5504d40294b6d42b4c233b6360f1b7e 100644 (file)
@@ -104,7 +104,7 @@ llap_print(netdissect_options *ndo,
                ND_PRINT((ndo, " [|llap %u]", length));
                return (length);
        }
-       if (!ND_TTEST2(*bp, sizeof(*lp))) {
+       if (!ND_TTEST_LEN(bp, sizeof(*lp))) {
                ND_PRINT((ndo, " [|llap]"));
                return (0);     /* cut short by the snapshot length */
        }
@@ -119,7 +119,7 @@ llap_print(netdissect_options *ndo,
                        ND_PRINT((ndo, " [|sddp %u]", length));
                        return (length);
                }
-               if (!ND_TTEST2(*bp, ddpSSize)) {
+               if (!ND_TTEST_LEN(bp, ddpSSize)) {
                        ND_PRINT((ndo, " [|sddp]"));
                        return (0);     /* cut short by the snapshot length */
                }
@@ -139,7 +139,7 @@ llap_print(netdissect_options *ndo,
                        ND_PRINT((ndo, " [|ddp %u]", length));
                        return (length);
                }
-               if (!ND_TTEST2(*bp, ddpSize)) {
+               if (!ND_TTEST_LEN(bp, ddpSize)) {
                        ND_PRINT((ndo, " [|ddp]"));
                        return (0);     /* cut short by the snapshot length */
                }
@@ -189,7 +189,7 @@ atalk_print(netdissect_options *ndo,
                ND_PRINT((ndo, " [|ddp %u]", length));
                return;
        }
-       if (!ND_TTEST2(*bp, ddpSize)) {
+       if (!ND_TTEST_LEN(bp, ddpSize)) {
                ND_PRINT((ndo, " [|ddp]"));
                return;
        }
index 5d4c8cb55f983aaef8bd7cf0aa05b7007f524f0f..3f0166d1ec3364ce35e9ad7803fe1977b684944f 100644 (file)
@@ -377,7 +377,7 @@ babel_print_v2(netdissect_options *ndo,
         ICHECK(i, 2);
         len = EXTRACT_U_1(message + 1);
 
-        ND_TCHECK2(*message, 2 + len);
+        ND_TCHECK_LEN(message, 2 + len);
         ICHECK(i, 2 + len);
 
         switch(type) {
index 64a162d7499192523344fd9337b392850bb4a33b..2be7a7b611c963ae464b47faaa7238772454b58d 100644 (file)
@@ -31,7 +31,7 @@ static int
 l_strnstart(netdissect_options *ndo, const char *tstr1, u_int tl1,
     const char *str2, u_int l2)
 {
-       if (!ND_TTEST2(*str2, tl1)) {
+       if (!ND_TTEST_LEN(str2, tl1)) {
                /*
                 * We don't have tl1 bytes worth of captured data
                 * for the string, so we can't check for this
index c408ac310cf42a7218744ace6cbc2946527b9ed7..45ec2c5c074c1bf6ce8f0f423ff10b3b7bf0586f 100644 (file)
@@ -245,7 +245,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr)
                 ND_TCHECK_4(pptr);
                 ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)));
                 pptr += 4;
-                ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN);
+                ND_TCHECK_LEN(pptr, AUTH_MD5_HASH_LEN);
                 ND_PRINT((ndo, "\n\t  Digest: "));
                 for(i = 0; i < AUTH_MD5_HASH_LEN; i++)
                     ND_PRINT((ndo, "%02x", EXTRACT_U_1(pptr + i)));
@@ -276,7 +276,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr)
                 ND_TCHECK_4(pptr);
                 ND_PRINT((ndo, ", Sequence Number: 0x%08x", EXTRACT_BE_U_4(pptr)));
                 pptr += 4;
-                ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN);
+                ND_TCHECK_LEN(pptr, AUTH_SHA1_HASH_LEN);
                 ND_PRINT((ndo, "\n\t  Hash: "));
                 for(i = 0; i < AUTH_SHA1_HASH_LEN; i++)
                     ND_PRINT((ndo, "%02x", EXTRACT_U_1(pptr + i)));
index 0ff3da054bc7ec01991b4b58d2c0c8dfebb8f868..1f446f21366ccbb44d90fd5e69388ac80661667d 100644 (file)
@@ -547,7 +547,7 @@ decode_prefix4(netdissect_options *ndo,
 
        memset(&addr, 0, sizeof(addr));
        plenbytes = (plen + 7) / 8;
-       ND_TCHECK2(pptr[1], plenbytes);
+       ND_TCHECK_LEN(pptr + 1, plenbytes);
        ITEMCHECK(plenbytes);
        memcpy(&addr, pptr + 1, plenbytes);
        if (plen % 8) {
@@ -595,7 +595,7 @@ decode_labeled_prefix4(netdissect_options *ndo,
 
        memset(&addr, 0, sizeof(addr));
        plenbytes = (plen + 7) / 8;
-       ND_TCHECK2(pptr[4], plenbytes);
+       ND_TCHECK_LEN(pptr + 4, plenbytes);
        ITEMCHECK(plenbytes);
        memcpy(&addr, pptr + 4, plenbytes);
        if (plen % 8) {
@@ -634,11 +634,11 @@ bgp_vpn_ip_print(netdissect_options *ndo,
 
     switch(addr_length) {
     case (sizeof(struct in_addr) << 3): /* 32 */
-        ND_TCHECK2(pptr[0], sizeof(struct in_addr));
+        ND_TCHECK_LEN(pptr, sizeof(struct in_addr));
         snprintf(pos, sizeof(addr), "%s", ipaddr_string(ndo, pptr));
         break;
     case (sizeof(struct in6_addr) << 3): /* 128 */
-        ND_TCHECK2(pptr[0], sizeof(struct in6_addr));
+        ND_TCHECK_LEN(pptr, sizeof(struct in6_addr));
         snprintf(pos, sizeof(addr), "%s", ip6addr_string(ndo, pptr));
         break;
     default:
@@ -685,7 +685,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
     pptr++;
 
     /* Source address */
-    ND_TCHECK2(pptr[0], (addr_length >> 3));
+    ND_TCHECK_LEN(pptr, (addr_length >> 3));
     total_length += (addr_length >> 3) + 1;
     offset = strlen(buf);
     if (addr_length) {
@@ -700,7 +700,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
     pptr++;
 
     /* Group address */
-    ND_TCHECK2(pptr[0], (addr_length >> 3));
+    ND_TCHECK_LEN(pptr, (addr_length >> 3));
     total_length += (addr_length >> 3) + 1;
     offset = strlen(buf);
     if (addr_length) {
@@ -800,7 +800,7 @@ decode_rt_routing_info(netdissect_options *ndo,
         * target" field inside this NLRI "prefix". Look for it.
         */
        memset(&route_target, 0, sizeof(route_target));
-       ND_TCHECK2(pptr[5], (plen + 7) / 8);
+       ND_TCHECK_LEN(pptr + 5, (plen + 7) / 8);
        memcpy(&route_target, pptr + 5, (plen + 7) / 8);
        /* Which specification says to do this? */
        if (plen % 8) {
@@ -836,7 +836,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo,
                return -1;
 
        memset(&addr, 0, sizeof(addr));
-       ND_TCHECK2(pptr[12], (plen + 7) / 8);
+       ND_TCHECK_LEN(pptr + 12, (plen + 7) / 8);
        memcpy(&addr, pptr + 12, (plen + 7) / 8);
        if (plen % 8) {
                ((u_char *)&addr)[(plen + 7) / 8 - 1] &=
@@ -889,12 +889,12 @@ decode_mdt_vpn_nlri(netdissect_options *ndo,
     pptr+=8;
 
     /* IPv4 address */
-    ND_TCHECK2(pptr[0], sizeof(struct in_addr));
+    ND_TCHECK_LEN(pptr, sizeof(struct in_addr));
     vpn_ip = pptr;
     pptr+=sizeof(struct in_addr);
 
     /* MDT Group Address */
-    ND_TCHECK2(pptr[0], sizeof(struct in_addr));
+    ND_TCHECK_LEN(pptr, sizeof(struct in_addr));
 
     snprintf(buf, buflen, "RD: %s, VPN IP Address: %s, MC Group Address: %s",
             bgp_vpn_rd_print(ndo, rd), ipaddr_string(ndo, vpn_ip), ipaddr_string(ndo, pptr));
@@ -945,7 +945,7 @@ decode_multicast_vpn(netdissect_options *ndo,
 
         switch(route_type) {
         case BGP_MULTICAST_VPN_ROUTE_TYPE_INTRA_AS_I_PMSI:
-            ND_TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
             offset = strlen(buf);
             snprintf(buf + offset, buflen - offset, ", RD: %s, Originator %s",
                      bgp_vpn_rd_print(ndo, pptr),
@@ -953,7 +953,7 @@ decode_multicast_vpn(netdissect_options *ndo,
                                       (route_length - BGP_VPN_RD_LEN) << 3));
             break;
         case BGP_MULTICAST_VPN_ROUTE_TYPE_INTER_AS_I_PMSI:
-            ND_TCHECK2(pptr[0], BGP_VPN_RD_LEN + 4);
+            ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN + 4);
             offset = strlen(buf);
            snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
                bgp_vpn_rd_print(ndo, pptr),
@@ -962,7 +962,7 @@ decode_multicast_vpn(netdissect_options *ndo,
             break;
 
         case BGP_MULTICAST_VPN_ROUTE_TYPE_S_PMSI:
-            ND_TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
             offset = strlen(buf);
             snprintf(buf + offset, buflen - offset, ", RD: %s",
                      bgp_vpn_rd_print(ndo, pptr));
@@ -971,14 +971,14 @@ decode_multicast_vpn(netdissect_options *ndo,
             sg_length = bgp_vpn_sg_print(ndo, pptr, buf, buflen);
             addr_length =  route_length - sg_length;
 
-            ND_TCHECK2(pptr[0], addr_length);
+            ND_TCHECK_LEN(pptr, addr_length);
             offset = strlen(buf);
             snprintf(buf + offset, buflen - offset, ", Originator %s",
                      bgp_vpn_ip_print(ndo, pptr, addr_length << 3));
             break;
 
         case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_ACTIVE:
-            ND_TCHECK2(pptr[0], BGP_VPN_RD_LEN);
+            ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN);
             offset = strlen(buf);
             snprintf(buf + offset, buflen - offset, ", RD: %s",
                      bgp_vpn_rd_print(ndo, pptr));
@@ -989,7 +989,7 @@ decode_multicast_vpn(netdissect_options *ndo,
 
         case BGP_MULTICAST_VPN_ROUTE_TYPE_SHARED_TREE_JOIN: /* fall through */
         case BGP_MULTICAST_VPN_ROUTE_TYPE_SOURCE_TREE_JOIN:
-            ND_TCHECK2(pptr[0], BGP_VPN_RD_LEN + 4);
+            ND_TCHECK_LEN(pptr, BGP_VPN_RD_LEN + 4);
             offset = strlen(buf);
            snprintf(buf + offset, buflen - offset, ", RD: %s, Source-AS %s",
                bgp_vpn_rd_print(ndo, pptr),
@@ -1050,7 +1050,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
          */
         if (plen==12) {
            /* assume AD-only with RD, BGPNH */
-           ND_TCHECK2(pptr[0],12);
+           ND_TCHECK_LEN(pptr, 12);
            buf[0]='\0';
            stringlen=snprintf(buf, buflen, "RD: %s, BGPNH: %s",
                               bgp_vpn_rd_print(ndo, pptr),
@@ -1064,7 +1064,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
            /* assume old format */
            /* RD, ID, LBLKOFF, LBLBASE */
 
-           ND_TCHECK2(pptr[0],15);
+           ND_TCHECK_LEN(pptr, 15);
            buf[0]='\0';
            stringlen=snprintf(buf, buflen, "RD: %s, CE-ID: %u, Label-Block Offset: %u, Label Base %u",
                               bgp_vpn_rd_print(ndo, pptr),
@@ -1145,7 +1145,7 @@ decode_prefix6(netdissect_options *ndo,
 
        memset(&addr, 0, sizeof(addr));
        plenbytes = (plen + 7) / 8;
-       ND_TCHECK2(pd[1], plenbytes);
+       ND_TCHECK_LEN(pd + 1, plenbytes);
        ITEMCHECK(plenbytes);
        memcpy(&addr, pd + 1, plenbytes);
        if (plen % 8) {
@@ -1185,7 +1185,7 @@ decode_labeled_prefix6(netdissect_options *ndo,
 
        memset(&addr, 0, sizeof(addr));
        plenbytes = (plen + 7) / 8;
-       ND_TCHECK2(pptr[4], plenbytes);
+       ND_TCHECK_LEN(pptr + 4, plenbytes);
        memcpy(&addr, pptr + 4, plenbytes);
        if (plen % 8) {
                addr.s6_addr[plenbytes - 1] &=
@@ -1226,7 +1226,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo,
                return -1;
 
        memset(&addr, 0, sizeof(addr));
-       ND_TCHECK2(pptr[12], (plen + 7) / 8);
+       ND_TCHECK_LEN(pptr + 12, (plen + 7) / 8);
        memcpy(&addr, pptr + 12, (plen + 7) / 8);
        if (plen % 8) {
                addr.s6_addr[(plen + 7) / 8 - 1] &=
@@ -1260,7 +1260,7 @@ decode_clnp_prefix(netdissect_options *ndo,
                return -1;
 
        memset(&addr, 0, sizeof(addr));
-       ND_TCHECK2(pptr[4], (plen + 7) / 8);
+       ND_TCHECK_LEN(pptr + 4, (plen + 7) / 8);
        memcpy(&addr, pptr + 4, (plen + 7) / 8);
        if (plen % 8) {
                addr[(plen + 7) / 8 - 1] &=
@@ -1295,7 +1295,7 @@ decode_labeled_vpn_clnp_prefix(netdissect_options *ndo,
                return -1;
 
        memset(&addr, 0, sizeof(addr));
-       ND_TCHECK2(pptr[12], (plen + 7) / 8);
+       ND_TCHECK_LEN(pptr + 12, (plen + 7) / 8);
        memcpy(&addr, pptr + 12, (plen + 7) / 8);
        if (plen % 8) {
                addr[(plen + 7) / 8 - 1] &=
@@ -1435,7 +1435,7 @@ bgp_attr_print(netdissect_options *ndo,
                                                "?", EXTRACT_U_1(tptr))));
                        ND_TCHECK_1(tptr + 1);
                         for (i = 0; i < tptr[1] * as_size; i += as_size) {
-                            ND_TCHECK2(tptr[2 + i], as_size);
+                            ND_TCHECK_LEN(tptr + 2 + i, as_size);
                            ND_PRINT((ndo, "%s ",
                                as_printf(ndo, astostr, sizeof(astostr),
                                as_size == 2 ?
@@ -1480,7 +1480,7 @@ bgp_attr_print(netdissect_options *ndo,
                     ND_PRINT((ndo, "invalid len"));
                     break;
                 }
-                ND_TCHECK2(tptr[0], len);
+                ND_TCHECK_LEN(tptr, len);
                 if (len == 6) {
                    ND_PRINT((ndo, " AS #%s, origin %s",
                        as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(tptr)),
@@ -1595,7 +1595,7 @@ bgp_attr_print(netdissect_options *ndo,
                 case (AFNUM_VPLS<<8 | SAFNUM_VPLS):
                     break;
                 default:
-                    ND_TCHECK2(tptr[0], tlen);
+                    ND_TCHECK_LEN(tptr, tlen);
                     ND_PRINT((ndo, "\n\t    no AFI %u / SAFI %u decoder", af, safi));
                     if (ndo->ndo_vflag <= 1)
                         print_unknown_data(ndo, tptr, "\n\t    ", tlen);
@@ -1629,7 +1629,7 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], sizeof(struct in_addr));
+                                ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
                                 ND_PRINT((ndo, "%s",ipaddr_string(ndo, tptr)));
                                 tlen -= sizeof(struct in_addr);
                                 tptr += sizeof(struct in_addr);
@@ -1642,7 +1642,8 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], sizeof(struct in_addr)+BGP_VPN_RD_LEN);
+                                ND_TCHECK_LEN(tptr,
+                                              sizeof(struct in_addr) + BGP_VPN_RD_LEN);
                                 ND_PRINT((ndo, "RD: %s, %s",
                                        bgp_vpn_rd_print(ndo, tptr),
                                        ipaddr_string(ndo, tptr+BGP_VPN_RD_LEN)));
@@ -1658,7 +1659,7 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], sizeof(struct in6_addr));
+                                ND_TCHECK_LEN(tptr, sizeof(struct in6_addr));
                                 ND_PRINT((ndo, "%s", ip6addr_string(ndo, tptr)));
                                 tlen -= sizeof(struct in6_addr);
                                 tptr += sizeof(struct in6_addr);
@@ -1671,7 +1672,8 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
+                                ND_TCHECK_LEN(tptr,
+                                              sizeof(struct in6_addr) + BGP_VPN_RD_LEN);
                                 ND_PRINT((ndo, "RD: %s, %s",
                                        bgp_vpn_rd_print(ndo, tptr),
                                        ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN)));
@@ -1687,7 +1689,7 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], sizeof(struct in_addr));
+                                ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
                                 ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr)));
                                 tlen -= (sizeof(struct in_addr));
                                 tptr += (sizeof(struct in_addr));
@@ -1696,7 +1698,7 @@ bgp_attr_print(netdissect_options *ndo,
                         case (AFNUM_NSAP<<8 | SAFNUM_UNICAST):
                         case (AFNUM_NSAP<<8 | SAFNUM_MULTICAST):
                         case (AFNUM_NSAP<<8 | SAFNUM_UNIMULTICAST):
-                            ND_TCHECK2(tptr[0], tlen);
+                            ND_TCHECK_LEN(tptr, tlen);
                             ND_PRINT((ndo, "%s", isonsap_string(ndo, tptr, tlen)));
                             tptr += tlen;
                             tlen = 0;
@@ -1709,7 +1711,7 @@ bgp_attr_print(netdissect_options *ndo,
                                 ND_PRINT((ndo, "invalid len"));
                                 tlen = 0;
                             } else {
-                                ND_TCHECK2(tptr[0], tlen);
+                                ND_TCHECK_LEN(tptr, tlen);
                                 ND_PRINT((ndo, "RD: %s, %s",
                                        bgp_vpn_rd_print(ndo, tptr),
                                        isonsap_string(ndo, tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN)));
@@ -1724,7 +1726,7 @@ bgp_attr_print(netdissect_options *ndo,
                             }
                             break;
                         default:
-                            ND_TCHECK2(tptr[0], tlen);
+                            ND_TCHECK_LEN(tptr, tlen);
                             ND_PRINT((ndo, "no AFI %u/SAFI %u decoder", af, safi));
                             if (ndo->ndo_vflag <= 1)
                                 print_unknown_data(ndo, tptr, "\n\t    ", tlen);
@@ -1889,7 +1891,7 @@ bgp_attr_print(netdissect_options *ndo,
                             ND_PRINT((ndo, "\n\t      %s", buf));
                         break;
                     default:
-                        ND_TCHECK2(*tptr,tlen);
+                        ND_TCHECK_LEN(tptr, tlen);
                         ND_PRINT((ndo, "\n\t    no AFI %u / SAFI %u decoder", af, safi));
                         if (ndo->ndo_vflag <= 1)
                             print_unknown_data(ndo, tptr, "\n\t    ", tlen);
@@ -1905,7 +1907,7 @@ bgp_attr_print(netdissect_options *ndo,
                break;
 
        case BGPTYPE_MP_UNREACH_NLRI:
-               ND_TCHECK2(tptr[0], BGP_MP_NLRI_MINSIZE);
+               ND_TCHECK_LEN(tptr, BGP_MP_NLRI_MINSIZE);
                af = EXTRACT_BE_U_2(tptr);
                safi = EXTRACT_U_1(tptr + 2);
 
@@ -2047,7 +2049,7 @@ bgp_attr_print(netdissect_options *ndo,
                             ND_PRINT((ndo, "\n\t      %s", buf));
                         break;
                     default:
-                        ND_TCHECK2(*(tptr-3),tlen);
+                        ND_TCHECK_LEN(tptr - 3, tlen);
                         ND_PRINT((ndo, "no AFI %u / SAFI %u decoder", af, safi));
                         if (ndo->ndo_vflag <= 1)
                             print_unknown_data(ndo, tptr-3, "\n\t    ", tlen);
@@ -2231,7 +2233,7 @@ bgp_attr_print(netdissect_options *ndo,
                    /*
                     * Check if we can read the TLV data.
                     */
-                   ND_TCHECK2(tptr[3], length);
+                   ND_TCHECK_LEN(tptr + 3, length);
 
                    switch (type) {
 
@@ -2273,7 +2275,7 @@ bgp_attr_print(netdissect_options *ndo,
                     tptr += 2;
                     len -= 2;
                     alenlen = bgp_attr_lenlen(aflags, tptr);
-                    ND_TCHECK2(tptr[0], alenlen);
+                    ND_TCHECK_LEN(tptr, alenlen);
                     if (len < alenlen)
                         goto trunc;
                     alen = bgp_attr_len(aflags, tptr);
@@ -2311,7 +2313,7 @@ bgp_attr_print(netdissect_options *ndo,
                }
                ND_PRINT((ndo, "\n\t    "));
                while (len > 0) {
-                       ND_TCHECK2(*tptr, 12);
+                       ND_TCHECK_LEN(tptr, 12);
                        ND_PRINT((ndo, "%u:%u:%u%s",
                                 EXTRACT_BE_U_4(tptr),
                                 EXTRACT_BE_U_4(tptr + 4),
@@ -2322,14 +2324,14 @@ bgp_attr_print(netdissect_options *ndo,
                }
                break;
        default:
-           ND_TCHECK2(*pptr,len);
+           ND_TCHECK_LEN(pptr, len);
             ND_PRINT((ndo, "\n\t    no Attribute %u decoder", atype)); /* we have no decoder for the attribute */
             if (ndo->ndo_vflag <= 1)
                 print_unknown_data(ndo, pptr, "\n\t    ", len);
             break;
        }
         if (ndo->ndo_vflag > 1 && len) { /* omit zero length attributes*/
-            ND_TCHECK2(*pptr,len);
+            ND_TCHECK_LEN(pptr, len);
             print_unknown_data(ndo, pptr, "\n\t    ", len);
         }
         return 1;
@@ -2346,7 +2348,7 @@ bgp_capabilities_print(netdissect_options *ndo,
         int i = 0;
 
         while (i < caps_len) {
-                ND_TCHECK2(opt[i], BGP_CAP_HEADER_SIZE);
+                ND_TCHECK_LEN(opt + i, BGP_CAP_HEADER_SIZE);
                 cap_type=EXTRACT_U_1(opt + i);
                 cap_len=EXTRACT_U_1(opt + i + 1);
                 tcap_len=cap_len;
@@ -2355,7 +2357,7 @@ bgp_capabilities_print(netdissect_options *ndo,
                                   cap_type),
                        cap_type,
                        cap_len));
-                ND_TCHECK2(opt[i+2], cap_len);
+                ND_TCHECK_LEN(opt + 2 + i, cap_len);
                 switch (cap_type) {
                 case BGP_CAPCODE_MP:
                     ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u)",
@@ -2449,7 +2451,7 @@ bgp_open_print(netdissect_options *ndo,
        const u_char *opt;
        int i;
 
-       ND_TCHECK2(dat[0], BGP_OPEN_SIZE);
+       ND_TCHECK_LEN(dat, BGP_OPEN_SIZE);
        memcpy(&bgpo, dat, BGP_OPEN_SIZE);
 
        ND_PRINT((ndo, "\n\t  Version %d, ", bgpo.bgpo_version));
@@ -2469,7 +2471,7 @@ bgp_open_print(netdissect_options *ndo,
 
        i = 0;
        while (i < bgpo.bgpo_optlen) {
-               ND_TCHECK2(opt[i], BGP_OPT_SIZE);
+               ND_TCHECK_LEN(opt + i, BGP_OPT_SIZE);
                memcpy(&bgpopt, opt + i, BGP_OPT_SIZE);
                if (i + 2 + bgpopt.bgpopt_len > bgpo.bgpo_optlen) {
                        ND_PRINT((ndo, "\n\t     Option %d, length: %u", bgpopt.bgpopt_type, bgpopt.bgpopt_len));
@@ -2513,7 +2515,7 @@ bgp_update_print(netdissect_options *ndo,
        int len;
        int i;
 
-       ND_TCHECK2(dat[0], BGP_SIZE);
+       ND_TCHECK_LEN(dat, BGP_SIZE);
        if (length < BGP_SIZE)
                goto trunc;
        memcpy(&bgp, dat, BGP_SIZE);
@@ -2533,7 +2535,7 @@ bgp_update_print(netdissect_options *ndo,
                 * it's not possible to tell if this a v4 or v6 route,
                 * so only try to decode it if we're not v6 enabled.
                 */
-               ND_TCHECK2(p[0], withdrawn_routes_len);
+               ND_TCHECK_LEN(p, withdrawn_routes_len);
                if (length < withdrawn_routes_len)
                        goto trunc;
                ND_PRINT((ndo, "\n\t  Withdrawn routes: %d bytes", withdrawn_routes_len));
@@ -2570,7 +2572,7 @@ bgp_update_print(netdissect_options *ndo,
                        len -= 2;
                        length -= 2;
                        alenlen = bgp_attr_lenlen(aflags, p);
-                       ND_TCHECK2(p[0], alenlen);
+                       ND_TCHECK_LEN(p, alenlen);
                        if (len < alenlen)
                            goto trunc;
                        if (length < alenlen)
@@ -2649,7 +2651,7 @@ bgp_notification_print(netdissect_options *ndo,
        uint8_t shutdown_comm_length;
        uint8_t remainder_offset;
 
-       ND_TCHECK2(dat[0], BGP_NOTIFICATION_SIZE);
+       ND_TCHECK_LEN(dat, BGP_NOTIFICATION_SIZE);
        memcpy(&bgpn, dat, BGP_NOTIFICATION_SIZE);
 
         /* some little sanity checking */
@@ -2735,7 +2737,7 @@ bgp_notification_print(netdissect_options *ndo,
                    }
                    /* a proper shutdown communication */
                    else {
-                           ND_TCHECK2(*(tptr+1), shutdown_comm_length);
+                           ND_TCHECK_LEN(tptr + 1, shutdown_comm_length);
                            ND_PRINT((ndo, ", Shutdown Communication (length: %u): \"", shutdown_comm_length));
                            (void)fn_printn(ndo, tptr+1, shutdown_comm_length, NULL);
                            ND_PRINT((ndo, "\""));
@@ -2763,7 +2765,7 @@ bgp_route_refresh_print(netdissect_options *ndo,
 {
         const struct bgp_route_refresh *bgp_route_refresh_header;
 
-       ND_TCHECK2(pptr[0], BGP_ROUTE_REFRESH_SIZE);
+       ND_TCHECK_LEN(pptr, BGP_ROUTE_REFRESH_SIZE);
 
         /* some little sanity checking */
         if (len<BGP_ROUTE_REFRESH_SIZE)
@@ -2782,7 +2784,7 @@ bgp_route_refresh_print(netdissect_options *ndo,
                bgp_route_refresh_header->safi));
 
         if (ndo->ndo_vflag > 1) {
-            ND_TCHECK2(*pptr, len);
+            ND_TCHECK_LEN(pptr, len);
             print_unknown_data(ndo, pptr, "\n\t  ", len);
         }
 
@@ -2797,7 +2799,7 @@ bgp_header_print(netdissect_options *ndo,
 {
        struct bgp bgp;
 
-       ND_TCHECK2(dat[0], BGP_SIZE);
+       ND_TCHECK_LEN(dat, BGP_SIZE);
        memcpy(&bgp, dat, BGP_SIZE);
        ND_PRINT((ndo, "\n\t%s Message (%u), length: %u",
                tok2str(bgp_msg_values, "Unknown", bgp.bgp_type),
@@ -2821,7 +2823,7 @@ bgp_header_print(netdissect_options *ndo,
                 break;
         default:
                 /* we have no decoder for the BGP message */
-                ND_TCHECK2(*dat, length);
+                ND_TCHECK_LEN(dat, length);
                 ND_PRINT((ndo, "\n\t  no Message %u decoder", bgp.bgp_type));
                 print_unknown_data(ndo, dat, "\n\t  ", length);
                 break;
@@ -2865,7 +2867,7 @@ bgp_print(netdissect_options *ndo,
                        continue;
                }
 
-               if (!ND_TTEST2(p[0], sizeof(marker)))
+               if (!ND_TTEST_LEN(p, sizeof(marker)))
                        break;
                if (memcmp(p, marker, sizeof(marker)) != 0) {
                        p++;
@@ -2873,7 +2875,7 @@ bgp_print(netdissect_options *ndo,
                }
 
                /* found BGP header */
-               ND_TCHECK2(p[0], BGP_SIZE);     /*XXX*/
+               ND_TCHECK_LEN(p, BGP_SIZE);     /*XXX*/
                memcpy(&bgp, p, BGP_SIZE);
 
                if (start != p)
@@ -2886,7 +2888,7 @@ bgp_print(netdissect_options *ndo,
                        break;
                }
 
-               if (ND_TTEST2(p[0], hlen)) {
+               if (ND_TTEST_LEN(p, hlen)) {
                        if (!bgp_header_print(ndo, p, hlen))
                                return;
                        p += hlen;
index 737c5afc5dd02142083d4e4448b31bb477f9f96c..8e225f850b82a5436c0f002fdd7bf5763074eeba 100644 (file)
@@ -295,7 +295,7 @@ bootp_print(netdissect_options *ndo,
 
        ND_TCHECK(bp->bp_hlen);
        if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
-               ND_TCHECK2(bp->bp_chaddr[0], 6);
+               ND_TCHECK_LEN(bp->bp_chaddr, 6);
                ND_PRINT((ndo, " from %s", etheraddr_string(ndo, bp->bp_chaddr)));
        }
 
@@ -350,7 +350,7 @@ bootp_print(netdissect_options *ndo,
 
        /* Client's Ethernet address */
        if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
-               ND_TCHECK2(bp->bp_chaddr[0], 6);
+               ND_TCHECK_LEN(bp->bp_chaddr, 6);
                ND_PRINT((ndo, "\n\t  Client-Ethernet-Address %s", etheraddr_string(ndo, bp->bp_chaddr)));
        }
 
@@ -653,7 +653,7 @@ rfc1048_print(netdissect_options *ndo,
                                ND_PRINT((ndo, ", occurs %u", ntag));
                }
 
-               if (!ND_TTEST2(*bp, len)) {
+               if (!ND_TTEST_LEN(bp, len)) {
                        ND_PRINT((ndo, "[|rfc1048 %u]", len));
                        return;
                }
index b439a2d7a6fb4e92a45a59410162a946e5009354..589815544565d7f22c25b9a4a4e36c6c61b1080f 100644 (file)
@@ -71,7 +71,7 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le
                struct cksum_vec vec[1];
                vec[0].ptr = (const uint8_t *)bp;
                vec[0].len = len;
-               if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
+               if (ND_TTEST_LEN(bp, len) && in_cksum(vec, 1))
                        ND_PRINT((ndo, " (bad carp cksum %x!)",
                                EXTRACT_BE_U_2(bp + 6)));
        }
index 364af045eec3f4f9214ccf5d10d72f5b4246a93c..bf8262656003201db9e73fa6fdfd43ebf6a6c9c3 100644 (file)
@@ -104,7 +104,7 @@ cdp_print(netdissect_options *ndo,
 
        tptr = pptr; /* temporary pointer */
 
-       ND_TCHECK2(*tptr, CDP_HEADER_LEN);
+       ND_TCHECK_LEN(tptr, CDP_HEADER_LEN);
        ND_PRINT((ndo, "CDPv%u, ttl: %us", EXTRACT_U_1((tptr + CDP_HEADER_VERSION_OFFSET)),
                                           EXTRACT_U_1(tptr + CDP_HEADER_TTL_OFFSET)));
        if (ndo->ndo_vflag)
@@ -112,7 +112,7 @@ cdp_print(netdissect_options *ndo,
        tptr += CDP_HEADER_LEN;
 
        while (tptr < (pptr+length)) {
-               ND_TCHECK2(*tptr, CDP_TLV_HEADER_LEN); /* read out Type and Length */
+               ND_TCHECK_LEN(tptr, CDP_TLV_HEADER_LEN); /* read out Type and Length */
                type = EXTRACT_BE_U_2(tptr + CDP_TLV_TYPE_OFFSET);
                len  = EXTRACT_BE_U_2(tptr + CDP_TLV_LEN_OFFSET); /* object length includes the 4 bytes header length */
                if (len < CDP_TLV_HEADER_LEN) {
@@ -131,7 +131,7 @@ cdp_print(netdissect_options *ndo,
                tptr += CDP_TLV_HEADER_LEN;
                len -= CDP_TLV_HEADER_LEN;
 
-               ND_TCHECK2(*tptr, len);
+               ND_TCHECK_LEN(tptr, len);
 
                if (ndo->ndo_vflag || type == 1) { /* in non-verbose mode just print Device-ID */
 
@@ -328,7 +328,7 @@ cdp_print_addr(netdissect_options *ndo,
                         * Ethertype, address length = 16
                         */
                        p += 10;
-                       ND_TCHECK2(*p, al);
+                       ND_TCHECK_LEN(p, al);
                        if (p + al > endp)
                                goto trunc;
 
@@ -339,7 +339,7 @@ cdp_print_addr(netdissect_options *ndo,
                        /*
                         * Generic case: just print raw data
                         */
-                       ND_TCHECK2(*p, pl);
+                       ND_TCHECK_LEN(p, pl);
                        if (p + pl > endp)
                                goto trunc;
                        ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_U_1((p - 2)), pl));
@@ -352,7 +352,7 @@ cdp_print_addr(netdissect_options *ndo,
                                goto trunc;
                        ND_PRINT((ndo, ", al=%d, a=", al));
                        p += 2;
-                       ND_TCHECK2(*p, al);
+                       ND_TCHECK_LEN(p, al);
                        if (p + al > endp)
                                goto trunc;
                        while (al-- > 0) {
index 674a3117a52ba286699da980f60cb6d28c46aa6e..94624564693ddd4d4e0799bb34b64ccb8cb488f9 100644 (file)
@@ -544,7 +544,7 @@ cfm_print(netdissect_options *ndo,
         /* do we have the full tlv header ? */
         if (tlen < sizeof(struct cfm_tlv_header_t))
             goto tooshort;
-        ND_TCHECK2(*tptr, sizeof(struct cfm_tlv_header_t));
+        ND_TCHECK_LEN(tptr, sizeof(struct cfm_tlv_header_t));
         cfm_tlv_len=EXTRACT_BE_U_2(&cfm_tlv_header->length);
 
         ND_PRINT((ndo, ", length %u", cfm_tlv_len));
@@ -556,7 +556,7 @@ cfm_print(netdissect_options *ndo,
         /* do we have the full tlv ? */
         if (tlen < cfm_tlv_len)
             goto tooshort;
-        ND_TCHECK2(*tptr, cfm_tlv_len);
+        ND_TCHECK_LEN(tptr, cfm_tlv_len);
         hexdump = FALSE;
 
         switch(cfm_tlv_type) {
index d65e74375bb14e3ec5917b234fb6897064226238..1c6fe36b0f41c02cafbfba485244c0bdaa510933 100644 (file)
@@ -58,7 +58,7 @@ chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
 
        if (length < CHDLC_HDRLEN)
                goto trunc;
-       ND_TCHECK2(*p, CHDLC_HDRLEN);
+       ND_TCHECK_LEN(p, CHDLC_HDRLEN);
        proto = EXTRACT_BE_U_2(p + 2);
        if (ndo->ndo_eflag) {
                 ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ",
@@ -150,7 +150,7 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length)
                goto trunc;
 
        slarp = (const struct cisco_slarp *)cp;
-       ND_TCHECK2(*slarp, SLARP_MIN_LEN);
+       ND_TCHECK_LEN(slarp, SLARP_MIN_LEN);
        switch (EXTRACT_BE_U_4(&slarp->code)) {
        case SLARP_REQUEST:
                ND_PRINT((ndo, "request"));
index b4d1e8e53f00971d01cad30412fb961e4829085d..66d215fe456fe590852fbeb0e615cc00c85b2613 100644 (file)
@@ -305,7 +305,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
                          len - fixed_hdrlen));
                return;
        }
-       ND_TCHECK2(*dh, fixed_hdrlen);
+       ND_TCHECK_LEN(dh, fixed_hdrlen);
 
        sport = EXTRACT_BE_U_2(&dh->dccph_sport);
        dport = EXTRACT_BE_U_2(&dh->dccph_dport);
@@ -338,7 +338,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
        }
 
        /* checksum calculation */
-       if (ndo->ndo_vflag && ND_TTEST2(bp[0], len)) {
+       if (ndo->ndo_vflag && ND_TTEST_LEN(bp, len)) {
                uint16_t sum = 0, dccp_sum;
 
                dccp_sum = EXTRACT_BE_U_2(&dh->dccph_checksum);
@@ -560,7 +560,7 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in
                                  tok2str(dccp_option_values, "Option %u", EXTRACT_U_1(option))));
                return 0;
        }
-       ND_TCHECK2(*option, optlen);
+       ND_TCHECK_LEN(option, optlen);
 
        if (EXTRACT_U_1(option) >= 128) {
                ND_PRINT((ndo, "CCID option %d", EXTRACT_U_1(option)));
index 9eeff5f895d2e00959e22dd8d9317e6c34b6f94a..51070119915cbc02e3b38a8e4e894b69fbfd38b8 100644 (file)
@@ -512,7 +512,7 @@ decnet_print(netdissect_options *ndo,
                return;
        }
 
-       ND_TCHECK2(*ap, sizeof(short));
+       ND_TCHECK_LEN(ap, sizeof(short));
        pktlen = EXTRACT_LE_U_2(ap);
        if (pktlen < sizeof(struct shorthdr)) {
                ND_PRINT((ndo, "%s", tstr));
@@ -537,7 +537,7 @@ decnet_print(netdissect_options *ndo,
                ND_PRINT((ndo, "%s", tstr));
                return;
            }
-           ND_TCHECK2(ap[sizeof(short)], padlen);
+           ND_TCHECK_LEN(ap + sizeof(short), padlen);
            ap += padlen;
            length -= padlen;
            caplen -= padlen;
@@ -772,7 +772,7 @@ print_l1_routes(netdissect_options *ndo,
 
        /* The last short is a checksum */
        while (len > (3 * sizeof(short))) {
-           ND_TCHECK2(*rp, 3 * sizeof(short));
+           ND_TCHECK_LEN(rp, 3 * sizeof(short));
            count = EXTRACT_LE_U_2(rp);
            if (count > 1024)
                return (1);     /* seems to be bogus from here on */
@@ -803,7 +803,7 @@ print_l2_routes(netdissect_options *ndo,
 
        /* The last short is a checksum */
        while (len > (3 * sizeof(short))) {
-           ND_TCHECK2(*rp, 3 * sizeof(short));
+           ND_TCHECK_LEN(rp, 3 * sizeof(short));
            count = EXTRACT_LE_U_2(rp);
            if (count > 1024)
                return (1);     /* seems to be bogus from here on */
index 16207fdff650ad5e25f31150f8bc542ae82051ad..5558660afbbec776c60e2e02ccc7810c589b3b35 100644 (file)
@@ -308,7 +308,7 @@ dhcp6opt_print(netdissect_options *ndo,
                        goto trunc;
                opttype = EXTRACT_BE_U_2(&dh6o->dh6opt_type);
                ND_PRINT((ndo, " (%s", tok2str(dh6opt_str, "opt_%u", opttype)));
-               ND_TCHECK2(*(cp + sizeof(*dh6o)), optlen);
+               ND_TCHECK_LEN(cp + sizeof(*dh6o), optlen);
                switch (opttype) {
                case DH6OPT_CLIENTID:
                case DH6OPT_SERVERID:
index c0c05d6737a447ec431b3ccb9154ac62407b6dfb..5281df13fd3f80ee34dd143b6428a61d9b9073f2 100644 (file)
@@ -379,7 +379,7 @@ ns_rprint(netdissect_options *ndo,
        } else
                cp = ns_nskip(ndo, cp);
 
-       if (cp == NULL || !ND_TTEST2(*cp, 10))
+       if (cp == NULL || !ND_TTEST_LEN(cp, 10))
                return (ndo->ndo_snapend);
 
        /* print the type/qtype */
@@ -427,7 +427,7 @@ ns_rprint(netdissect_options *ndo,
 
        switch (typ) {
        case T_A:
-               if (!ND_TTEST2(*cp, sizeof(struct in_addr)))
+               if (!ND_TTEST_LEN(cp, sizeof(struct in_addr)))
                        return(NULL);
                ND_PRINT((ndo, " %s", intoa(htonl(EXTRACT_BE_U_4(cp)))));
                break;
@@ -452,7 +452,7 @@ ns_rprint(netdissect_options *ndo,
                ND_PRINT((ndo, " "));
                if ((cp = ns_nprint(ndo, cp, bp)) == NULL)
                        return(NULL);
-               if (!ND_TTEST2(*cp, 5 * 4))
+               if (!ND_TTEST_LEN(cp, 5 * 4))
                        return(NULL);
                ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(cp)));
                cp += 4;
@@ -498,7 +498,7 @@ ns_rprint(netdissect_options *ndo,
            {
                char ntop_buf[INET6_ADDRSTRLEN];
 
-               if (!ND_TTEST2(*cp, sizeof(struct in6_addr)))
+               if (!ND_TTEST_LEN(cp, sizeof(struct in6_addr)))
                        return(NULL);
                ND_PRINT((ndo, " %s",
                    addrtostr6(cp, ntop_buf, sizeof(ntop_buf))));
@@ -520,7 +520,7 @@ ns_rprint(netdissect_options *ndo,
                        ND_PRINT((ndo, " %u(bad plen)", pbit));
                        break;
                } else if (pbit < 128) {
-                       if (!ND_TTEST2(*(cp + 1), sizeof(a) - pbyte))
+                       if (!ND_TTEST_LEN(cp + 1, sizeof(a) - pbyte))
                                return(NULL);
                        memset(&a, 0, sizeof(a));
                        memcpy(&a.s6_addr[pbyte], cp + 1, sizeof(a) - pbyte);
@@ -542,7 +542,7 @@ ns_rprint(netdissect_options *ndo,
                break;
 
        case T_UNSPECA:         /* One long string */
-               if (!ND_TTEST2(*cp, len))
+               if (!ND_TTEST_LEN(cp, len))
                        return(NULL);
                if (fn_printn(ndo, cp, len, ndo->ndo_snapend))
                        return(NULL);
index 4799f2607274440f0897cc8466e7ffd857d6ada2..bf1242e0a09dfb1cdf656e8c7981a18aece69b64 100644 (file)
@@ -54,7 +54,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
 
     tptr = pptr;
 
-    ND_TCHECK2(*tptr, DTP_HEADER_LEN);
+    ND_TCHECK_LEN(tptr, DTP_HEADER_LEN);
 
     ND_PRINT((ndo, "DTPv%u, length %u",
            EXTRACT_U_1(tptr),
@@ -84,7 +84,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
         /* infinite loop check */
         if (len < 4)
             goto invalid;
-        ND_TCHECK2(*tptr, len);
+        ND_TCHECK_LEN(tptr, len);
 
         switch (type) {
        case DTP_DOMAIN_TLV:
index 5f56043bf1f7e639f618e1b9b8a36353b1b70fe1..cfc3f710080ebba064fec69efd001c8a77c6c498 100644 (file)
@@ -345,7 +345,7 @@ static int
 print_prune(netdissect_options *ndo,
             register const u_char *bp)
 {
-       ND_TCHECK2(bp[0], 12);
+       ND_TCHECK_LEN(bp, 12);
        ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)));
        bp += 8;
        ND_PRINT((ndo, " timer "));
index 30c48616aaa6429221b4eb2e646e0360c2c79e2e..95eaa17ad5e17e3a1256c8f5becb34e3cabe2892 100644 (file)
@@ -192,7 +192,7 @@ eap_print(netdissect_options *ndo,
                EXTRACT_U_1((tptr + 1)),
                len));
 
-        ND_TCHECK2(*tptr, len);
+        ND_TCHECK_LEN(tptr, len);
 
         if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
             ND_TCHECK_1(tptr + 4);
index f4bd860efe5089e93c9dfc1a943dd72b637dbf0a..7bcf16cfeded3bd6aa63a644e3422429dc4a9691 100644 (file)
@@ -162,7 +162,7 @@ egpnrprint(netdissect_options *ndo,
                addr = 0;
                if (length < 4 - netlen)
                        goto trunc;
-               ND_TCHECK2(cp[0], 4 - netlen);
+               ND_TCHECK_LEN(cp, 4 - netlen);
                switch (netlen) {
 
                case 1:
index c4aea0167271dd5cdbae074ae64e0e890a2247a2..2a13915146bd4e1a033593316cd160a9c1e80f9e 100644 (file)
@@ -273,7 +273,7 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
 
     while(tlen>0) {
         /* did we capture enough for fully decoding the object header ? */
-        ND_TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct eigrp_tlv_header));
 
         eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
         eigrp_tlv_len=EXTRACT_BE_U_2(&eigrp_tlv_header->length);
@@ -302,7 +302,7 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         tlv_tlen=eigrp_tlv_len-sizeof(struct eigrp_tlv_header);
 
         /* did we capture enough for fully decoding the object ? */
-        ND_TCHECK2(*tptr, eigrp_tlv_len);
+        ND_TCHECK_LEN(tptr, eigrp_tlv_len);
 
         switch(eigrp_tlv_type) {
 
index cd68ae81885d358b069189e7f79bc1c6aefdbe01..c5d5e5d73153a60f38fc192d154f238ac28e3c60 100644 (file)
@@ -471,7 +471,7 @@ mfr_print(netdissect_options *ndo,
             return hdr_len;
 
         while (tlen>sizeof(struct ie_tlv_header_t)) {
-            ND_TCHECK2(*tptr, sizeof(struct ie_tlv_header_t));
+            ND_TCHECK_LEN(tptr, sizeof(struct ie_tlv_header_t));
             ie_type=EXTRACT_U_1(tptr);
             ie_len=EXTRACT_U_1(tptr + 1);
 
@@ -484,7 +484,7 @@ mfr_print(netdissect_options *ndo,
             if (ie_type == 0 || ie_len <= sizeof(struct ie_tlv_header_t))
                 return hdr_len;
 
-            ND_TCHECK2(*tptr, ie_len);
+            ND_TCHECK_LEN(tptr, ie_len);
             tptr+=sizeof(struct ie_tlv_header_t);
             /* tlv len includes header */
             ie_len-=sizeof(struct ie_tlv_header_t);
@@ -1020,7 +1020,7 @@ q933_print(netdissect_options *ndo,
                        if (iecode == 0 || ielength == 0) {
                                return;
                        }
-                       if (length < ielength || !ND_TTEST2(*p, ielength)) {
+                       if (length < ielength || !ND_TTEST_LEN(p, ielength)) {
                                if (!ndo->ndo_vflag) {
                                        ND_PRINT((ndo, ", length %u", olen));
                                }
index 280be187b3a22b421e31e2d3b305cb92e8349e43..724e9f02f4edc8e39be0137a2aa1c846bc7d89ff 100644 (file)
@@ -202,7 +202,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len)
         return;
     }
 
-    ND_TCHECK2(*bp, opts_len);
+    ND_TCHECK_LEN(bp, opts_len);
 
     if (opts_len > 0) {
         ND_PRINT((ndo, ", options ["));
index e96b0c491e3fc120f725617cc26adad413026799..488969ef9703dd0fe97c7a32d37571c8043a3a02 100644 (file)
@@ -86,7 +86,7 @@ print_long_pos_vector(netdissect_options *ndo,
 {
        uint32_t lat, lon;
 
-       if (!ND_TTEST2(*bp, GEONET_ADDR_LEN))
+       if (!ND_TTEST_LEN(bp, GEONET_ADDR_LEN))
                return (-1);
        ND_PRINT((ndo, "GN_ADDR:%s ", linkaddr_string (ndo, bp, 0, GEONET_ADDR_LEN)));
 
@@ -232,7 +232,7 @@ geonet_print(netdissect_options *ndo, const u_char *bp, u_int length,
        if (hdr_size >= 0) {
                if (length < (u_int)hdr_size)
                        goto invalid;
-               ND_TCHECK2(*bp, hdr_size);
+               ND_TCHECK_LEN(bp, hdr_size);
                length -= hdr_size;
                bp += hdr_size;
                switch (next_hdr) {
index 09acbcf4715c5c5eb1c61546f1e024b669923ce4..00ab04d13499cf8536ec355efb6929daaed08f32 100644 (file)
@@ -431,7 +431,7 @@ hncp_print_rec(netdissect_options *ndo,
         type = EXTRACT_BE_U_2(tlv);
         bodylen = EXTRACT_BE_U_2(tlv + 2);
         value = tlv + 4;
-        ND_TCHECK2(*value, bodylen);
+        ND_TCHECK_LEN(value, bodylen);
         if (i + bodylen + 4 > length)
             goto invalid;
 
index 6e517d8db7c1cb0d7ae957235f328b2cad643914..ff65a854a0a40f5652e8dc07cef42cefb04891ca 100644 (file)
@@ -559,7 +559,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
        }
        ND_PRINT((ndo, "ICMP %s, length %u", str, plen));
        if (ndo->ndo_vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
-               if (ND_TTEST2(*bp, plen)) {
+               if (ND_TTEST_LEN(bp, plen)) {
                        uint16_t sum;
 
                        vec[0].ptr = (const uint8_t *)(const void *)dp;
index 1e1454a802d033e448f458c642713332bd28a106..594c9153bfc80697c29c74072cd22eca000195d1 100644 (file)
@@ -663,7 +663,7 @@ rpl_dio_printopt(netdissect_options *ndo,
 
         while((opt->rpl_dio_type == RPL_OPT_PAD0 &&
                (const u_char *)opt < ndo->ndo_snapend) ||
-              ND_TTEST2(*opt,(opt->rpl_dio_len+2))) {
+              ND_TTEST_LEN(opt, (opt->rpl_dio_len + 2))) {
 
                 unsigned int optlen = opt->rpl_dio_len+2;
                 if(opt->rpl_dio_type == RPL_OPT_PAD0) {
@@ -772,7 +772,7 @@ rpl_daoack_print(netdissect_options *ndo,
         const struct nd_rpl_daoack *daoack = (const struct nd_rpl_daoack *)bp;
         const char *dagid_str = "<elided>";
 
-        ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN);
+        ND_TCHECK_LEN(daoack, ND_RPL_DAOACK_MIN_LEN);
         if (length < ND_RPL_DAOACK_MIN_LEN)
                goto tooshort;
 
@@ -890,7 +890,7 @@ icmp6_print(netdissect_options *ndo,
        if (ndo->ndo_vflag && !fragmented) {
                uint16_t sum, udp_sum;
 
-               if (ND_TTEST2(bp[0], length)) {
+               if (ND_TTEST_LEN(bp, length)) {
                        udp_sum = EXTRACT_BE_U_2(&dp->icmp6_cksum);
                        sum = icmp6_cksum(ndo, ip, dp, length);
                        if (sum != 0)
@@ -1432,7 +1432,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
                     ND_PRINT((ndo," [invalid number of groups]"));
                     return;
            }
-            ND_TCHECK2(bp[group + 4], sizeof(struct in6_addr));
+            ND_TCHECK_LEN(bp + 4 + group, sizeof(struct in6_addr));
             ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + group + 4)));
            ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]",
                                          EXTRACT_U_1(bp + group))));
@@ -1449,8 +1449,8 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len)
                /* Print the sources */
                     ND_PRINT((ndo," {"));
                 for (j = 0; j < nsrcs; j++) {
-                    ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
-                            sizeof(struct in6_addr));
+                    ND_TCHECK_LEN(bp + group + 20 + (j * sizeof(struct in6_addr)),
+                                  sizeof(struct in6_addr));
                    ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + group + 20 + (j * sizeof(struct in6_addr)))));
                }
                 ND_PRINT((ndo," }"));
@@ -1490,7 +1490,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
     if (ndo->ndo_vflag) {
             ND_PRINT((ndo," [max resp delay=%d]", mrt));
     }
-    ND_TCHECK2(bp[8], sizeof(struct in6_addr));
+    ND_TCHECK_LEN(bp + 8, sizeof(struct in6_addr));
     ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + 8)));
 
     if (ndo->ndo_vflag) {
@@ -1518,8 +1518,8 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
        else if (ndo->ndo_vflag > 1) {
            ND_PRINT((ndo," {"));
            for (i = 0; i < nsrcs; i++) {
-               ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)],
-                        sizeof(struct in6_addr));
+               ND_TCHECK_LEN(bp + 28 + (i * sizeof(struct in6_addr)),
+                              sizeof(struct in6_addr));
                ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + 28 + (i * sizeof(struct in6_addr)))));
            }
            ND_PRINT((ndo," }"));
@@ -1594,7 +1594,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                }
                ND_PRINT((ndo," node information query"));
 
-               ND_TCHECK2(*dp, sizeof(*ni6));
+               ND_TCHECK_LEN(dp, sizeof(*ni6));
                ni6 = (const struct icmp6_nodeinfo *)dp;
                ND_PRINT((ndo," ("));   /*)*/
                switch (EXTRACT_BE_U_2(&ni6->ni_qtype)) {
@@ -1650,8 +1650,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
 
                switch (ni6->ni_code) {
                case ICMP6_NI_SUBJ_IPV6:
-                       if (!ND_TTEST2(*dp,
-                           sizeof(*ni6) + sizeof(struct in6_addr)))
+                       if (!ND_TTEST_LEN(dp, sizeof(*ni6) + sizeof(struct in6_addr)))
                                break;
                        if (siz != sizeof(*ni6) + sizeof(struct in6_addr)) {
                                if (ndo->ndo_vflag)
@@ -1679,7 +1678,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                                dnsname_print(ndo, cp, ep);
                        break;
                case ICMP6_NI_SUBJ_IPV4:
-                       if (!ND_TTEST2(*dp, sizeof(*ni6) + sizeof(struct in_addr)))
+                       if (!ND_TTEST_LEN(dp, sizeof(*ni6) + sizeof(struct in_addr)))
                                break;
                        if (siz != sizeof(*ni6) + sizeof(struct in_addr)) {
                                if (ndo->ndo_vflag)
@@ -1706,7 +1705,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
 
                needcomma = 0;
 
-               ND_TCHECK2(*dp, sizeof(*ni6));
+               ND_TCHECK_LEN(dp, sizeof(*ni6));
                ni6 = (const struct icmp6_nodeinfo *)dp;
                ND_PRINT((ndo," node information reply"));
                ND_PRINT((ndo," ("));   /*)*/
index 082919e1bd68732b3003789c526ee06238fcaddd..d0dfd3294785a6d2f63a088df36eaa377f5fb9d8 100644 (file)
@@ -334,7 +334,7 @@ igmp_print(netdissect_options *ndo,
         break;
     }
 
-    if (ndo->ndo_vflag && len >= 4 && ND_TTEST2(bp[0], len)) {
+    if (ndo->ndo_vflag && len >= 4 && ND_TTEST_LEN(bp, len)) {
         /* Check the IGMP checksum */
         vec[0].ptr = bp;
         vec[0].len = len;
index 6cd4f69e8c6f600499970c8fae6e5e13f298af9b..10915f882149d6e9f541aeb1e88555ce36c9f8f7 100644 (file)
@@ -130,15 +130,15 @@ igrp_print(netdissect_options *ndo, register const u_char *bp, u_int length)
        length -= sizeof(*hdr);
        while (length >= IGRP_RTE_SIZE) {
                if (nint > 0) {
-                       ND_TCHECK2(*cp, IGRP_RTE_SIZE);
+                       ND_TCHECK_LEN(cp, IGRP_RTE_SIZE);
                        igrp_entry_print(ndo, (const struct igrprte *)cp, 1, 0);
                        --nint;
                } else if (nsys > 0) {
-                       ND_TCHECK2(*cp, IGRP_RTE_SIZE);
+                       ND_TCHECK_LEN(cp, IGRP_RTE_SIZE);
                        igrp_entry_print(ndo, (const struct igrprte *)cp, 0, 0);
                        --nsys;
                } else if (next > 0) {
-                       ND_TCHECK2(*cp, IGRP_RTE_SIZE);
+                       ND_TCHECK_LEN(cp, IGRP_RTE_SIZE);
                        igrp_entry_print(ndo, (const struct igrprte *)cp, 0, 1);
                        --next;
                } else {
index b1deb78a0ee62386a825f2c510a84c7bedbf6638..f2d1edbaaa5505e98ada4b55ab00e29a65707455 100644 (file)
@@ -118,7 +118,7 @@ ip_finddst(netdissect_options *ndo,
                        if (len < 2)
                                break;
                }
-               ND_TCHECK2(*cp, len);
+               ND_TCHECK_LEN(cp, len);
                switch (tt) {
 
                case IPOPT_SSRR:
@@ -220,7 +220,7 @@ ip_printts(netdissect_options *ndo,
        for (len = 4; len < length; len += hoplen) {
                if (ptr == len)
                        type = " ^ ";
-               ND_TCHECK2(cp[len], hoplen);
+               ND_TCHECK_LEN(cp + len, hoplen);
                ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_U_4(cp + len + hoplen - 4),
                          hoplen!=8 ? "" : ipaddr_string(ndo, cp + len)));
                type = " ";
@@ -279,7 +279,7 @@ ip_optprint(netdissect_options *ndo,
                        return;
                }
 
-               ND_TCHECK2(*cp, option_len);
+               ND_TCHECK_LEN(cp, option_len);
 
                switch (option_code) {
                case IPOPT_EOL:
index 5cf8ba4a235ddd098f29c56fa9bde01fbe7cc139..41b292e722eebbd6c0ca91fb2cfdec9596ad20d8 100644 (file)
@@ -178,7 +178,7 @@ hbhopt_print(netdissect_options *ndo, register const u_char *bp)
 
     ND_TCHECK(dp->ip6h_len);
     hbhlen = (dp->ip6h_len + 1) << 3;
-    ND_TCHECK2(*dp, hbhlen);
+    ND_TCHECK_LEN(dp, hbhlen);
     ND_PRINT((ndo, "HBH "));
     if (ndo->ndo_vflag)
        ip6_opt_print(ndo, (const u_char *)dp + sizeof(*dp), hbhlen - sizeof(*dp));
@@ -198,7 +198,7 @@ dstopt_print(netdissect_options *ndo, register const u_char *bp)
 
     ND_TCHECK(dp->ip6d_len);
     dstoptlen = (dp->ip6d_len + 1) << 3;
-    ND_TCHECK2(*dp, dstoptlen);
+    ND_TCHECK_LEN(dp, dstoptlen);
     ND_PRINT((ndo, "DSTOPT "));
     if (ndo->ndo_vflag) {
        ip6_opt_print(ndo, (const u_char *)dp + sizeof(*dp),
index dbfd7b19b8aa0f537ecdf21c2c55bc095eb2baed..ac0801219d20b73ecd9b60d825f10ad4afa3e617 100644 (file)
@@ -198,7 +198,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length)
            /*
             * 10 bytes of IPX address.
             */
-           ND_TCHECK2(*ipx, 10);
+           ND_TCHECK_LEN(ipx, 10);
            if (length < 10)
                goto trunc;
            ND_PRINT((ndo, " addr %s",
@@ -209,7 +209,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length)
             * 2 bytes of socket and 2 bytes of number of intermediate
             * networks.
             */
-           ND_TCHECK2(*ipx, 4);
+           ND_TCHECK_LEN(ipx, 4);
            if (length < 4)
                goto trunc;
            ipx += 4;
@@ -241,7 +241,7 @@ ipx_rip_print(netdissect_options *ndo, const u_char *ipx, u_int length)
        if (length != 0) {
            if (length < 8)
                goto trunc;
-           ND_TCHECK2(*ipx, 8);
+           ND_TCHECK_LEN(ipx, 8);
            ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx),
                         EXTRACT_BE_U_2(ipx + 4), EXTRACT_BE_U_2(ipx + 6)));
        }
@@ -251,7 +251,7 @@ 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_TCHECK2(*ipx, 8);
+           ND_TCHECK_LEN(ipx, 8);
            ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_U_4(ipx),
                         EXTRACT_BE_U_2(ipx + 4), EXTRACT_BE_U_2(ipx + 6)));
 
index d82c4f2848cc85e0d223d210b39d5e9a8f87ea29..a2683ac61a0d17c09d71dfb06ff406729eda1382 100644 (file)
@@ -862,7 +862,7 @@ hexprint(netdissect_options *ndo, const uint8_t *loc, size_t len)
 static int
 rawprint(netdissect_options *ndo, const uint8_t *loc, size_t len)
 {
-       ND_TCHECK2(*loc, len);
+       ND_TCHECK_LEN(loc, len);
 
        hexprint(ndo, loc, len);
        return 1;
@@ -1048,7 +1048,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
 
        np = (const u_char *)ext + sizeof(sa);
        if (sit != 0x01) {
-               ND_TCHECK2(*(ext + 1), sizeof(ident));
+               ND_TCHECK_LEN(ext + 1, sizeof(ident));
                UNALIGNED_MEMCPY(&ident, ext + 1, sizeof(ident));
                ND_PRINT((ndo," ident=%u", (uint32_t)ntohl(ident)));
                np += sizeof(ident);
@@ -1393,7 +1393,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
                        break;
                if (data == NULL)
                        goto trunc;
-               ND_TCHECK2(*data, len);
+               ND_TCHECK_LEN(data, len);
                switch (doi_id.type) {
                case IPSECDOI_ID_IPV4_ADDR:
                        if (len < 4)
@@ -2044,7 +2044,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
 
                if (prop_length < item_len)
                        goto toolong;
-               ND_TCHECK2(*cp, item_len);
+               ND_TCHECK_LEN(cp, item_len);
 
                depth++;
                ND_PRINT((ndo,"\n"));
@@ -2130,7 +2130,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
 
                if (sa_length < item_len)
                        goto toolong;
-               ND_TCHECK2(*cp, item_len);
+               ND_TCHECK_LEN(cp, item_len);
 
                depth++;
                ND_PRINT((ndo,"\n"));
@@ -2259,7 +2259,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
        }
 
        if(dumpascii) {
-               ND_TCHECK2(*typedata, idtype_len);
+               ND_TCHECK_LEN(typedata, idtype_len);
                for(i=0; i<idtype_len; i++) {
                        if(ND_ISPRINT(EXTRACT_U_1(typedata + i))) {
                                ND_PRINT((ndo, "%c", EXTRACT_U_1(typedata + i)));
@@ -2312,7 +2312,7 @@ ikev2_auth_print(netdissect_options *ndo, u_char tpay,
        const u_char *authdata = (const u_char*)ext + sizeof(a);
        unsigned int len;
 
-       ND_TCHECK2(*ext, sizeof(a));
+       ND_TCHECK_LEN(ext, sizeof(a));
        UNALIGNED_MEMCPY(&a, ext, sizeof(a));
        ikev2_pay_print(ndo, NPSTR(tpay), a.h.critical);
        len = ntohs(a.h.len);
@@ -2602,7 +2602,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
 
        vid = (const u_char *)(ext+1);
        len = ntohs(e.len) - 4;
-       ND_TCHECK2(*vid, len);
+       ND_TCHECK_LEN(vid, len);
        for(i=0; i<len; i++) {
                if(ND_ISPRINT(EXTRACT_U_1(vid + i)))
                        ND_PRINT((ndo, "%c", EXTRACT_U_1(vid + i)));
@@ -2674,7 +2674,7 @@ ikev2_e_print(netdissect_options *ndo,
        }
 
        dat = (const u_char *)(ext+1);
-       ND_TCHECK2(*dat, dlen);
+       ND_TCHECK_LEN(dat, dlen);
 
 #ifdef HAVE_LIBCRYPTO
        /* try to decypt it! */
@@ -2777,7 +2777,7 @@ ikev1_sub_print(netdissect_options *ndo,
                ND_TCHECK(*ext);
                UNALIGNED_MEMCPY(&e, ext, sizeof(e));
 
-               ND_TCHECK2(*ext, ntohs(e.len));
+               ND_TCHECK_LEN(ext, ntohs(e.len));
 
                depth++;
                ND_PRINT((ndo,"\n"));
@@ -2944,7 +2944,7 @@ ikev2_sub_print(netdissect_options *ndo,
                ND_TCHECK(*ext);
                UNALIGNED_MEMCPY(&e, ext, sizeof(e));
 
-               ND_TCHECK2(*ext, ntohs(e.len));
+               ND_TCHECK_LEN(ext, ntohs(e.len));
 
                depth++;
                ND_PRINT((ndo,"\n"));
index 53ad5697ba50aab4baa0051eb8c484bf44a6e34f..131fe7f4d91f1cec2faab607e89c72b18694ef91 100644 (file)
@@ -824,7 +824,7 @@ clnp_print(netdissect_options *ndo,
             ND_PRINT((ndo, "li < size of fixed part of CLNP header and addresses"));
             return (0);
         }
-        ND_TCHECK2(*pptr, dest_address_length);
+        ND_TCHECK_LEN(pptr, dest_address_length);
         dest_address = pptr;
         pptr += dest_address_length;
         li -= dest_address_length;
@@ -841,7 +841,7 @@ clnp_print(netdissect_options *ndo,
             ND_PRINT((ndo, "li < size of fixed part of CLNP header and addresses"));
             return (0);
         }
-        ND_TCHECK2(*pptr, source_address_length);
+        ND_TCHECK_LEN(pptr, source_address_length);
         source_address = pptr;
         pptr += source_address_length;
         li -= source_address_length;
@@ -911,7 +911,7 @@ clnp_print(netdissect_options *ndo,
                 ND_PRINT((ndo, ", opt (%d) too long", op));
                 return (0);
             }
-            ND_TCHECK2(*pptr, opli);
+            ND_TCHECK_LEN(pptr, opli);
             li -= opli;
             tptr = pptr;
             tlen = opli;
@@ -923,8 +923,8 @@ clnp_print(netdissect_options *ndo,
 
             /*
              * We've already checked that the entire option is present
-             * in the captured packet with the ND_TCHECK2() call.
-             * Therefore, we don't need to do ND_TCHECK()/ND_TCHECK2()
+             * in the captured packet with the ND_TCHECK_LEN() call.
+             * Therefore, we don't need to do ND_TCHECK()/ND_TCHECK_LEN()
              * checks.
              * We do, however, need to check tlen, to make sure we
              * don't run past the end of the option.
@@ -961,7 +961,8 @@ clnp_print(netdissect_options *ndo,
                             }
                             if (source_address_length > 0) {
                                     source_address=(tptr+1);
-                                    ND_TCHECK2(*source_address, source_address_length);
+                                    ND_TCHECK_LEN(source_address,
+                                                  source_address_length);
                                     ND_PRINT((ndo, "\n\t    NSAP address (length %u): %s",
                                            source_address_length,
                                            isonsap_string(ndo, source_address, source_address_length)));
@@ -1182,7 +1183,7 @@ esis_print(netdissect_options *ndo,
                dstl = EXTRACT_U_1(pptr);
                pptr++;
                li--;
-               ND_TCHECK2(*pptr, dstl);
+               ND_TCHECK_LEN(pptr, dstl);
                if (li < dstl) {
                        ND_PRINT((ndo, ", bad redirect/li"));
                        return;
@@ -1200,7 +1201,7 @@ esis_print(netdissect_options *ndo,
                snpal = EXTRACT_U_1(pptr);
                pptr++;
                li--;
-               ND_TCHECK2(*pptr, snpal);
+               ND_TCHECK_LEN(pptr, snpal);
                if (li < snpal) {
                        ND_PRINT((ndo, ", bad redirect/li"));
                        return;
@@ -1215,7 +1216,7 @@ esis_print(netdissect_options *ndo,
                }
                netal = EXTRACT_U_1(pptr);
                pptr++;
-               ND_TCHECK2(*pptr, netal);
+               ND_TCHECK_LEN(pptr, netal);
                if (li < netal) {
                        ND_PRINT((ndo, ", bad redirect/li"));
                        return;
@@ -1261,7 +1262,7 @@ esis_print(netdissect_options *ndo,
                 pptr++;
                li--;
 
-                ND_TCHECK2(*pptr, source_address_length);
+                ND_TCHECK_LEN(pptr, source_address_length);
                if (li < source_address_length) {
                     ND_PRINT((ndo, ", bad esh/li"));
                    return;
@@ -1285,7 +1286,7 @@ esis_print(netdissect_options *ndo,
             source_address_length = EXTRACT_U_1(pptr);
             pptr++;
             li--;
-            ND_TCHECK2(*pptr, source_address_length);
+            ND_TCHECK_LEN(pptr, source_address_length);
             if (li < source_address_length) {
                 ND_PRINT((ndo, ", bad ish/li"));
                 return;
@@ -1429,7 +1430,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
     if (len < stlv_len)
       goto trunc;
     /* Make sure the entire subTLV is in the captured data */
-    ND_TCHECK2(*(tptr), stlv_len);
+    ND_TCHECK_LEN(tptr, stlv_len);
 
     switch (stlv_type)
     {
@@ -1548,7 +1549,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
     if (len < stlv_len)
       goto trunc;
     /* Make sure the entire subTLV is in the captured data */
-    ND_TCHECK2(*(tptr), stlv_len);
+    ND_TCHECK_LEN(tptr, stlv_len);
 
     switch (stlv_type)
     {
@@ -1783,7 +1784,7 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo,
               ident, tok2str(isis_ext_ip_reach_subtlv_values, "unknown", subt),
               subt, subl));
 
-    ND_TCHECK2(*tptr,subl);
+    ND_TCHECK_LEN(tptr, subl);
 
     switch(subt) {
     case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR: /* fall through */
@@ -1839,7 +1840,7 @@ isis_print_is_reach_subtlv(netdissect_options *ndo,
                  ident, tok2str(isis_ext_is_reach_subtlv_values, "unknown", subt),
                  subt, subl));
 
-       ND_TCHECK2(*tptr, subl);
+       ND_TCHECK_LEN(tptr, subl);
 
         switch(subt) {
         case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
@@ -1995,7 +1996,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
     int subtlv_type,subtlv_len,subtlv_sum_len;
     int proc_bytes = 0; /* how many bytes did we process ? */
 
-    if (!ND_TTEST2(*tptr, NODE_ID_LEN))
+    if (!ND_TTEST_LEN(tptr, NODE_ID_LEN))
         return(0);
 
     ND_PRINT((ndo, "%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN)));
@@ -2111,7 +2112,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
 
     byte_length = (bit_length + 7) / 8; /* prefix has variable length encoding */
 
-    if (!ND_TTEST2(*tptr, byte_length))
+    if (!ND_TTEST_LEN(tptr, byte_length))
         return (0);
     memset(prefix, 0, sizeof prefix);   /* clear the copy buffer */
     memcpy(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
@@ -2594,7 +2595,7 @@ isis_print(netdissect_options *ndo,
            alen = EXTRACT_U_1(tptr);
            tptr++;
            while (tmp && alen < tmp) {
-               ND_TCHECK2(*tptr, alen);
+               ND_TCHECK_LEN(tptr, alen);
                ND_PRINT((ndo, "\n\t      Area address (length: %u): %s",
                        alen,
                        isonsap_string(ndo, tptr, alen)));
@@ -2609,7 +2610,7 @@ isis_print(netdissect_options *ndo,
            break;
        case ISIS_TLV_ISNEIGH:
            while (tmp >= ETHER_ADDR_LEN) {
-                ND_TCHECK2(*tptr, ETHER_ADDR_LEN);
+                ND_TCHECK_LEN(tptr, ETHER_ADDR_LEN);
                 ND_PRINT((ndo, "\n\t      SNPA: %s", isis_print_id(tptr, ETHER_ADDR_LEN)));
                 tmp -= ETHER_ADDR_LEN;
                 tptr += ETHER_ADDR_LEN;
@@ -2628,7 +2629,7 @@ isis_print(netdissect_options *ndo,
             tmp --;
             ND_PRINT((ndo, "\n\t      LAN address length %u bytes ", lan_alen));
            while (tmp >= lan_alen) {
-                ND_TCHECK2(*tptr, lan_alen);
+                ND_TCHECK_LEN(tptr, lan_alen);
                 ND_PRINT((ndo, "\n\t\tIS Neighbor: %s", isis_print_id(tptr, lan_alen)));
                 tmp -= lan_alen;
                 tptr +=lan_alen;
@@ -2766,7 +2767,7 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_IP6ADDR:
            while (tmp>=sizeof(struct in6_addr)) {
-               ND_TCHECK2(*tptr, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(tptr, sizeof(struct in6_addr));
 
                 ND_PRINT((ndo, "\n\t      IPv6 interface address: %s",
                       ip6addr_string(ndo, tptr)));
@@ -2898,13 +2899,13 @@ isis_print(netdissect_options *ndo,
       break;
 
        case ISIS_TLV_TE_ROUTER_ID:
-           ND_TCHECK2(*pptr, sizeof(struct in_addr));
+           ND_TCHECK_LEN(pptr, sizeof(struct in_addr));
            ND_PRINT((ndo, "\n\t      Traffic Engineering Router ID: %s", ipaddr_string(ndo, pptr)));
            break;
 
        case ISIS_TLV_IPADDR:
            while (tmp>=sizeof(struct in_addr)) {
-               ND_TCHECK2(*tptr, sizeof(struct in_addr));
+               ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
                ND_PRINT((ndo, "\n\t      IPv4 interface address: %s", ipaddr_string(ndo, tptr)));
                tptr += sizeof(struct in_addr);
                tmp -= sizeof(struct in_addr);
@@ -2920,7 +2921,7 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_SHARED_RISK_GROUP:
            if (tmp < NODE_ID_LEN)
                break;
-           ND_TCHECK2(*tptr, NODE_ID_LEN);
+           ND_TCHECK_LEN(tptr, NODE_ID_LEN);
            ND_PRINT((ndo, "\n\t      IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN)));
            tptr+=NODE_ID_LEN;
            tmp-=NODE_ID_LEN;
@@ -2934,14 +2935,14 @@ isis_print(netdissect_options *ndo,
 
            if (tmp < sizeof(struct in_addr))
                break;
-           ND_TCHECK2(*tptr, sizeof(struct in_addr));
+           ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
            ND_PRINT((ndo, "\n\t      IPv4 interface address: %s", ipaddr_string(ndo, tptr)));
            tptr+=sizeof(struct in_addr);
            tmp-=sizeof(struct in_addr);
 
            if (tmp < sizeof(struct in_addr))
                break;
-           ND_TCHECK2(*tptr, sizeof(struct in_addr));
+           ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
            ND_PRINT((ndo, "\n\t      IPv4 neighbor address: %s", ipaddr_string(ndo, tptr)));
            tptr+=sizeof(struct in_addr);
            tmp-=sizeof(struct in_addr);
@@ -2974,7 +2975,7 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_CHECKSUM:
            if (tmp < ISIS_TLV_CHECKSUM_MINLEN)
                break;
-           ND_TCHECK2(*tptr, ISIS_TLV_CHECKSUM_MINLEN);
+           ND_TCHECK_LEN(tptr, ISIS_TLV_CHECKSUM_MINLEN);
            ND_PRINT((ndo, "\n\t      checksum: 0x%04x ", EXTRACT_BE_U_2(tptr)));
             /* do not attempt to verify the checksum if it is zero
              * most likely a HMAC-MD5 TLV is also present and
@@ -2987,13 +2988,13 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_POI:
            if (tlv_len >= SYSTEM_ID_LEN + 1) {
-               ND_TCHECK2(*tptr, SYSTEM_ID_LEN + 1);
+               ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN + 1);
                ND_PRINT((ndo, "\n\t      Purge Originator System-ID: %s",
                       isis_print_id(tptr + 1, SYSTEM_ID_LEN)));
            }
 
            if (tlv_len == 2 * SYSTEM_ID_LEN + 1) {
-               ND_TCHECK2(*tptr, 2 * SYSTEM_ID_LEN + 1);
+               ND_TCHECK_LEN(tptr, 2 * SYSTEM_ID_LEN + 1);
                ND_PRINT((ndo, "\n\t      Received from System-ID: %s",
                       isis_print_id(tptr + SYSTEM_ID_LEN + 1, SYSTEM_ID_LEN)));
            }
@@ -3022,7 +3023,7 @@ isis_print(netdissect_options *ndo,
             /* first attempt to decode the flags */
             if (tmp < ISIS_TLV_RESTART_SIGNALING_FLAGLEN)
                 break;
-            ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN);
+            ND_TCHECK_LEN(tptr, ISIS_TLV_RESTART_SIGNALING_FLAGLEN);
             ND_PRINT((ndo, "\n\t      Flags [%s]",
                    bittok2str(isis_restart_flag_values, "none", EXTRACT_U_1(tptr))));
             tptr+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN;
@@ -3034,7 +3035,7 @@ isis_print(netdissect_options *ndo,
 
             if (tmp < ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN)
                 break;
-            ND_TCHECK2(*tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN);
+            ND_TCHECK_LEN(tptr, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN);
 
             ND_PRINT((ndo, ", Remaining holding time %us", EXTRACT_BE_U_2(tptr)));
             tptr+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN;
@@ -3042,7 +3043,7 @@ isis_print(netdissect_options *ndo,
 
             /* is there an additional sysid field present ?*/
             if (tmp == SYSTEM_ID_LEN) {
-                    ND_TCHECK2(*tptr, SYSTEM_ID_LEN);
+                    ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN);
                     ND_PRINT((ndo, ", for %s", isis_print_id(tptr,SYSTEM_ID_LEN)));
             }
            break;
@@ -3050,7 +3051,7 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_IDRP_INFO:
            if (tmp < ISIS_TLV_IDRP_INFO_MINLEN)
                break;
-            ND_TCHECK2(*tptr, ISIS_TLV_IDRP_INFO_MINLEN);
+            ND_TCHECK_LEN(tptr, ISIS_TLV_IDRP_INFO_MINLEN);
             ND_PRINT((ndo, "\n\t      Inter-Domain Information Type: %s",
                    tok2str(isis_subtlv_idrp_values,
                            "Unknown (0x%02x)",
@@ -3074,13 +3075,13 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_LSP_BUFFERSIZE:
            if (tmp < ISIS_TLV_LSP_BUFFERSIZE_MINLEN)
                break;
-            ND_TCHECK2(*tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN);
+            ND_TCHECK_LEN(tptr, ISIS_TLV_LSP_BUFFERSIZE_MINLEN);
             ND_PRINT((ndo, "\n\t      LSP Buffersize: %u", EXTRACT_BE_U_2(tptr)));
             break;
 
         case ISIS_TLV_PART_DIS:
             while (tmp >= SYSTEM_ID_LEN) {
-                ND_TCHECK2(*tptr, SYSTEM_ID_LEN);
+                ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN);
                 ND_PRINT((ndo, "\n\t      %s", isis_print_id(tptr, SYSTEM_ID_LEN)));
                 tptr+=SYSTEM_ID_LEN;
                 tmp-=SYSTEM_ID_LEN;
@@ -3090,7 +3091,7 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_PREFIX_NEIGH:
            if (tmp < sizeof(struct isis_metric_block))
                break;
-            ND_TCHECK2(*tptr, sizeof(struct isis_metric_block));
+            ND_TCHECK_LEN(tptr, sizeof(struct isis_metric_block));
             ND_PRINT((ndo, "\n\t      Metric Block"));
             isis_print_metric_block(ndo, (const struct isis_metric_block *)tptr);
             tptr+=sizeof(struct isis_metric_block);
@@ -3107,7 +3108,7 @@ isis_print(netdissect_options *ndo,
                 tmp--;
                 if (tmp < prefix_len/2)
                     break;
-                ND_TCHECK2(*tptr, prefix_len / 2);
+                ND_TCHECK_LEN(tptr, prefix_len / 2);
                 ND_PRINT((ndo, "\n\t\tAddress: %s/%u",
                        isonsap_string(ndo, tptr, prefix_len / 2), prefix_len * 4));
                 tptr+=prefix_len/2;
@@ -3118,14 +3119,14 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_IIH_SEQNR:
            if (tmp < ISIS_TLV_IIH_SEQNR_MINLEN)
                break;
-            ND_TCHECK2(*tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */
+            ND_TCHECK_LEN(tptr, ISIS_TLV_IIH_SEQNR_MINLEN); /* check if four bytes are on the wire */
             ND_PRINT((ndo, "\n\t      Sequence number: %u", EXTRACT_BE_U_4(tptr)));
             break;
 
         case ISIS_TLV_VENDOR_PRIVATE:
            if (tmp < ISIS_TLV_VENDOR_PRIVATE_MINLEN)
                break;
-            ND_TCHECK2(*tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */
+            ND_TCHECK_LEN(tptr, ISIS_TLV_VENDOR_PRIVATE_MINLEN); /* check if enough byte for a full oui */
             vendor_id = EXTRACT_BE_U_3(tptr);
             ND_PRINT((ndo, "\n\t      Vendor: %s (%u)",
                    tok2str(oui_values, "Unknown", vendor_id),
@@ -3193,7 +3194,7 @@ osi_print_cksum(netdissect_options *ndo, const uint8_t *pptr,
             || checksum_offset < 0
             || !ND_TTEST_2(pptr + checksum_offset)
             || (u_int)checksum_offset > length
-            || !ND_TTEST2(*pptr, length)) {
+            || !ND_TTEST_LEN(pptr, length)) {
                 ND_PRINT((ndo, " (unverified)"));
         } else {
 #if 0
index b8b3ec04e9e75a7548750396636a9dd3af43b292..55564579e5dd7b1be8ea30f2aeeb5c1188907c2b 100644 (file)
@@ -1232,7 +1232,7 @@ juniper_parse_header(netdissect_options *ndo,
         if (ndo->ndo_vflag > 1)
             ND_PRINT((ndo, ", PCAP Extension(s) total length %u", jnx_ext_len));
 
-        ND_TCHECK2(tptr[0], jnx_ext_len);
+        ND_TCHECK_LEN(tptr, jnx_ext_len);
         while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) {
             tlv_type = EXTRACT_U_1(tptr);
             tptr++;
@@ -1357,7 +1357,7 @@ juniper_parse_header(netdissect_options *ndo,
                        l2info->cookie_len));
 
             if (l2info->cookie_len > 0) {
-                ND_TCHECK2(p[0], l2info->cookie_len);
+                ND_TCHECK_LEN(p, l2info->cookie_len);
                 if (ndo->ndo_eflag)
                     ND_PRINT((ndo, ", cookie 0x"));
                 for (idx = 0; idx < l2info->cookie_len; idx++) {
index 24839bd4d9e64e7fcf5b6ea8fc805c33d850e461..de025f9300f40b893c558280b9beb21e6fd574a7 100644 (file)
@@ -218,7 +218,7 @@ krb4_print(netdissect_options *ndo,
                if ((cp = krb4_print_hdr(ndo, cp)) == NULL)
                        return;
                cp += 10;       /* timestamp + n + exp + kvno */
-               ND_TCHECK2(*cp, sizeof(short));
+               ND_TCHECK_LEN(cp, sizeof(short));
                len = KTOHSP(kp, cp);
                ND_PRINT((ndo, " (%d)", len));
                break;
@@ -227,7 +227,7 @@ krb4_print(netdissect_options *ndo,
                if ((cp = krb4_print_hdr(ndo, cp)) == NULL)
                        return;
                cp += 4;          /* timestamp */
-               ND_TCHECK2(*cp, sizeof(short));
+               ND_TCHECK_LEN(cp, sizeof(short));
                ND_PRINT((ndo, " %s ", tok2str(kerr2str, NULL, KTOHSP(kp, cp))));
                cp += 4;
                PRINT;
index 6cf0c0adfb1104c17b0d51b69071008913984bfd..eb92833b6a8601fc50af7a5bd71563410ccb65e2 100644 (file)
@@ -619,7 +619,7 @@ l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length)
 
        /* If it goes past the end of the remaining length of the captured
           data, we'll give up. */
-       ND_TCHECK2(*ptr, len);
+       ND_TCHECK_LEN(ptr, len);
 
        /*
         * After this point, we don't need to check whether we go past
index 4e71ade4402303d36553c15c4558c5f609faa556..e107c52b6ebf062176b9d3d5498c03a91afef7ca 100644 (file)
@@ -230,7 +230,7 @@ static int ldp_pdu_print(netdissect_options *, register const u_char *);
  */
 
 #define TLV_TCHECK(minlen) \
-    ND_TCHECK2(*tptr, minlen); if (tlv_tlen < minlen) goto badtlv;
+    ND_TCHECK_LEN(tptr, minlen); if (tlv_tlen < minlen) goto badtlv;
 
 static int
 ldp_tlv_print(netdissect_options *ndo,
@@ -304,7 +304,7 @@ ldp_tlv_print(netdissect_options *ndo,
         switch (af) {
         case AFNUM_INET:
            while(tlv_tlen >= sizeof(struct in_addr)) {
-               ND_TCHECK2(*tptr, sizeof(struct in_addr));
+               ND_TCHECK_LEN(tptr, sizeof(struct in_addr));
                ND_PRINT((ndo, " %s", ipaddr_string(ndo, tptr)));
                tlv_tlen-=sizeof(struct in_addr);
                tptr+=sizeof(struct in_addr);
@@ -312,7 +312,7 @@ ldp_tlv_print(netdissect_options *ndo,
             break;
         case AFNUM_INET6:
            while(tlv_tlen >= sizeof(struct in6_addr)) {
-               ND_TCHECK2(*tptr, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(tptr, sizeof(struct in6_addr));
                ND_PRINT((ndo, " %s", ip6addr_string(ndo, tptr)));
                tlv_tlen-=sizeof(struct in6_addr);
                tptr+=sizeof(struct in6_addr);
@@ -607,7 +607,7 @@ ldp_pdu_print(netdissect_options *ndo,
 
     while(tlen>0) {
         /* did we capture enough for fully decoding the msg header ? */
-        ND_TCHECK2(*tptr, sizeof(struct ldp_msg_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct ldp_msg_header));
 
         ldp_msg_header = (const struct ldp_msg_header *)tptr;
         msg_len=EXTRACT_BE_U_2(ldp_msg_header->length);
@@ -640,7 +640,7 @@ ldp_pdu_print(netdissect_options *ndo,
         msg_tlen=msg_len-(sizeof(struct ldp_msg_header)-4); /* Type & Length fields not included */
 
         /* did we capture enough for fully decoding the message ? */
-        ND_TCHECK2(*tptr, msg_len);
+        ND_TCHECK_LEN(tptr, msg_len);
         hexdump=FALSE;
 
         switch(msg_type) {
index c8486566d73370c20a2094c1e9ed4a2b91d2006a..804f898e862baf990d8051b6f108e4557e006867 100644 (file)
@@ -251,7 +251,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
        const lisp_map_register_loc *lisp_loc;
 
        /* Check if enough bytes for header are available */
-       ND_TCHECK2(*bp, MAP_REGISTER_HDR_LEN);
+       ND_TCHECK_LEN(bp, MAP_REGISTER_HDR_LEN);
        lisp_hdr = (const lisp_map_register_hdr *) bp;
        lisp_hdr_flag(ndo, lisp_hdr);
        /* Supporting only MAP NOTIFY and MAP REGISTER LISP packets */
@@ -287,7 +287,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
        /* Print all the EID records */
        while ((length > packet_offset) && (record_count--)) {
 
-               ND_TCHECK2(*(packet_iterator + packet_offset), MAP_REGISTER_EID_LEN);
+               ND_TCHECK_LEN(packet_iterator + packet_offset,
+                             MAP_REGISTER_EID_LEN);
                ND_PRINT((ndo, "\n"));
                lisp_eid = (const lisp_map_register_eid *)
                                ((const u_char *)lisp_hdr + packet_offset);
@@ -328,7 +329,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
                ND_PRINT((ndo, " %u locator(s)", loc_count));
 
                while (loc_count--) {
-                       ND_TCHECK2(*(packet_iterator + packet_offset), MAP_REGISTER_LOC_LEN);
+                       ND_TCHECK_LEN(packet_iterator + packet_offset,
+                                     MAP_REGISTER_LOC_LEN);
                        lisp_loc = (const lisp_map_register_loc *) (packet_iterator + packet_offset);
                        loc_ip_pointer = (const u_char *) (lisp_loc + 1);
                        packet_offset += MAP_REGISTER_LOC_LEN;
@@ -370,7 +372,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
         * show it as hex data.
         */
        if (xtr_present) {
-               if (!ND_TTEST2(*(packet_iterator + packet_offset), 24))
+               if (!ND_TTEST_LEN(packet_iterator + packet_offset, 24))
                        goto invalid;
                hex_print_with_offset(ndo, "\n    xTR-ID: ", packet_iterator + packet_offset, 16, 0);
                ND_PRINT((ndo, "\n    SITE-ID: %" PRIu64,
index 8212a7c27d24b7dc3f64460f2efe5ee9e6008f5e..f009f1ae2e1dad7a702d9aca182e654909954851 100644 (file)
@@ -515,7 +515,7 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                        /*
                         * Skip the padding.
                         */
-                       ND_TCHECK2(*p, bridge_pad);
+                       ND_TCHECK_LEN(p, bridge_pad);
                        caplen -= bridge_pad;
                        length -= bridge_pad;
                        p += bridge_pad;
@@ -536,7 +536,7 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                         * Skip the padding, but not the Access
                         * Control field.
                         */
-                       ND_TCHECK2(*p, bridge_pad);
+                       ND_TCHECK_LEN(p, bridge_pad);
                        caplen -= bridge_pad;
                        length -= bridge_pad;
                        p += bridge_pad;
@@ -557,7 +557,7 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
                        /*
                         * Skip the padding.
                         */
-                       ND_TCHECK2(*p, bridge_pad + 1);
+                       ND_TCHECK_LEN(p, bridge_pad + 1);
                        caplen -= bridge_pad + 1;
                        length -= bridge_pad + 1;
                        p += bridge_pad + 1;
index 49eb9e9d7d5acaa6bf67747f9d0c8111c923c4a3..90dba8ee8da80b9fe358c9ccdabb9f00758d9544 100644 (file)
@@ -1180,7 +1180,7 @@ lldp_private_dcbx_print(netdissect_options *ndo,
 
     while (tlen >= sizeof(tlv)) {
 
-        ND_TCHECK2(*tptr, sizeof(tlv));
+        ND_TCHECK_LEN(tptr, sizeof(tlv));
 
         tlv = EXTRACT_BE_U_2(tptr);
 
@@ -1196,7 +1196,7 @@ lldp_private_dcbx_print(netdissect_options *ndo,
             break;
         }
 
-        ND_TCHECK2(*tptr, tlv_len);
+        ND_TCHECK_LEN(tptr, tlv_len);
         if (tlen < tlv_len) {
             goto trunc;
         }
@@ -1440,7 +1440,7 @@ lldp_print(netdissect_options *ndo,
 
     while (tlen >= sizeof(tlv)) {
 
-        ND_TCHECK2(*tptr, sizeof(tlv));
+        ND_TCHECK_LEN(tptr, sizeof(tlv));
 
         tlv = EXTRACT_BE_U_2(tptr);
 
@@ -1462,7 +1462,7 @@ lldp_print(netdissect_options *ndo,
             break;
         }
 
-        ND_TCHECK2(*tptr, tlv_len);
+        ND_TCHECK_LEN(tptr, tlv_len);
         if (tlen < tlv_len) {
             goto trunc;
         }
index 97db2f47b185c1f77a44067c4f45a1d9aedd6b4c..295c02421e3e80ac52d16ed4473e3a573c93355f 100644 (file)
@@ -483,7 +483,7 @@ lmp_print(netdissect_options *ndo,
 
     while(tlen>0) {
         /* did we capture enough for fully decoding the object header ? */
-        ND_TCHECK2(*tptr, sizeof(struct lmp_object_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct lmp_object_header));
 
         lmp_obj_header = (const struct lmp_object_header *)tptr;
         lmp_obj_len=EXTRACT_BE_U_2(lmp_obj_header->length);
@@ -514,7 +514,7 @@ lmp_print(netdissect_options *ndo,
         obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
 
         /* did we capture enough for fully decoding the object ? */
-        ND_TCHECK2(*tptr, lmp_obj_len);
+        ND_TCHECK_LEN(tptr, lmp_obj_len);
         hexdump=FALSE;
 
         switch(lmp_obj_header->class_num) {
index 9ef77a97a1340820ee9a024618925f32529911bd..b740202569d98a3582ddbb8237f8ef7224875951 100644 (file)
@@ -78,28 +78,28 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le
                        cp += 2;
                        /* data */
                        ND_PRINT((ndo, ", data (%u octets)", len - 4));
-                       ND_TCHECK2(*cp, len - 4);
+                       ND_TCHECK_LEN(cp, len - 4);
                        break;
                case LOOPBACK_FWDDATA:
                        if (len < 8)
                                goto invalid;
                        /* forwarding address */
-                       ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+                       ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
                        ND_PRINT((ndo, ", forwarding address %s", etheraddr_string(ndo, cp)));
                        cp += ETHER_ADDR_LEN;
                        /* data */
                        ND_PRINT((ndo, ", data (%u octets)", len - 8));
-                       ND_TCHECK2(*cp, len - 8);
+                       ND_TCHECK_LEN(cp, len - 8);
                        break;
                default:
-                       ND_TCHECK2(*cp, len - 2);
+                       ND_TCHECK_LEN(cp, len - 2);
                        break;
        }
        return;
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -128,7 +128,7 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len)
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
index 89edc1dd8f8e940353b3e40769e5ce72c7c08e54..f32bbde7625fb371d815aded4914484f03a8de03 100644 (file)
@@ -605,7 +605,7 @@ lspping_print(netdissect_options *ndo,
             goto tooshort;
 
         /* did we capture enough for fully decoding the tlv header ? */
-        ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct lspping_tlv_header));
 
         lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
         lspping_tlv_type=EXTRACT_BE_U_2(lspping_tlv_header->type);
@@ -632,7 +632,7 @@ lspping_print(netdissect_options *ndo,
         if (tlen < lspping_tlv_len+sizeof(struct lspping_tlv_header))
             goto tooshort;
         /* did we capture enough for fully decoding the tlv ? */
-        ND_TCHECK2(*tlv_tptr, lspping_tlv_len);
+        ND_TCHECK_LEN(tlv_tptr, lspping_tlv_len);
         tlv_hexdump=FALSE;
 
         switch(lspping_tlv_type) {
@@ -645,7 +645,7 @@ lspping_print(netdissect_options *ndo,
                     goto tlv_tooshort;
                 }
                 /* did we capture enough for fully decoding the subtlv header ? */
-                ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_header));
+                ND_TCHECK_LEN(tlv_tptr, sizeof(struct lspping_tlv_header));
                 subtlv_hexdump=FALSE;
 
                 lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
@@ -661,7 +661,7 @@ lspping_print(netdissect_options *ndo,
                 }
 
                 /* Did we capture enough for fully decoding the subTLV? */
-                ND_TCHECK2(*subtlv_tptr, lspping_subtlv_len);
+                ND_TCHECK_LEN(subtlv_tptr, lspping_subtlv_len);
 
                 ND_PRINT((ndo, "\n\t    %s subTLV (%u), length: %u",
                        tok2str(lspping_tlvtargetfec_subtlv_values,
@@ -886,7 +886,8 @@ lspping_print(netdissect_options *ndo,
                 goto tlv_tooshort;
             }
             /* Did we capture enough to get the address family? */
-            ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_t));
+            ND_TCHECK_LEN(tlv_tptr,
+                          sizeof(struct lspping_tlv_downstream_map_t));
 
             tlv_ptr.lspping_tlv_downstream_map= \
                 (const struct lspping_tlv_downstream_map_t *)tlv_tptr;
@@ -912,7 +913,8 @@ lspping_print(netdissect_options *ndo,
                     goto tlv_tooshort;
                 }
                 /* Did we capture enough for this part of the TLV? */
-                ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_ipv4_t));
+                ND_TCHECK_LEN(tlv_tptr,
+                              sizeof(struct lspping_tlv_downstream_map_ipv4_t));
 
                 tlv_ptr.lspping_tlv_downstream_map_ipv4= \
                     (const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
@@ -931,7 +933,8 @@ lspping_print(netdissect_options *ndo,
                     goto tlv_tooshort;
                 }
                 /* Did we capture enough for this part of the TLV? */
-                ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t));
+                ND_TCHECK_LEN(tlv_tptr,
+                              sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t));
 
                 tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb= \
                     (const struct lspping_tlv_downstream_map_ipv4_unmb_t *)tlv_tptr;
@@ -950,7 +953,8 @@ lspping_print(netdissect_options *ndo,
                     goto tlv_tooshort;
                 }
                 /* Did we capture enough for this part of the TLV? */
-                ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_ipv6_t));
+                ND_TCHECK_LEN(tlv_tptr,
+                              sizeof(struct lspping_tlv_downstream_map_ipv6_t));
 
                 tlv_ptr.lspping_tlv_downstream_map_ipv6= \
                     (const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
@@ -969,7 +973,8 @@ lspping_print(netdissect_options *ndo,
                     goto tlv_tooshort;
                 }
                 /* Did we capture enough for this part of the TLV? */
-                ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t));
+                ND_TCHECK_LEN(tlv_tptr,
+                              sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t));
 
                 tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb= \
                    (const struct lspping_tlv_downstream_map_ipv6_unmb_t *)tlv_tptr;
@@ -993,7 +998,8 @@ lspping_print(netdissect_options *ndo,
                 goto tlv_tooshort;
             }
             /* Did we capture enough for this part of the TLV? */
-            ND_TCHECK2(*tlv_tptr, sizeof(struct lspping_tlv_downstream_map_info_t));
+            ND_TCHECK_LEN(tlv_tptr,
+                          sizeof(struct lspping_tlv_downstream_map_info_t));
 
             tlv_ptr.lspping_tlv_downstream_map_info= \
                 (const struct lspping_tlv_downstream_map_info_t *)tlv_tptr;
@@ -1015,7 +1021,7 @@ lspping_print(netdissect_options *ndo,
                 tlv_hexdump = TRUE;
                 goto tlv_tooshort;
             } else {
-                ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
+                ND_TCHECK_LEN(tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
                 ND_PRINT((ndo, "\n\t    BFD Discriminator 0x%08x", EXTRACT_BE_U_4(tptr)));
             }
             break;
@@ -1029,7 +1035,7 @@ lspping_print(netdissect_options *ndo,
                 tlv_hexdump = TRUE;
                 goto tlv_tooshort;
             } else {
-                ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
+                ND_TCHECK_LEN(tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
                 vendor_id = EXTRACT_BE_U_4(tlv_tptr);
                 ND_PRINT((ndo, "\n\t    Vendor: %s (0x%04x)",
                        tok2str(smi_values, "Unknown", vendor_id),
index a33c6d3cc0686d2b7aea45942ccdba296e3fc9f9..76ce9f9f5f038575e4343d90b52fd370623ea4c0 100644 (file)
@@ -222,7 +222,7 @@ lwapp_control_print(netdissect_options *ndo,
     while(tlen>0) {
 
         /* did we capture enough for fully decoding the object header ? */
-        ND_TCHECK2(*tptr, sizeof(struct lwapp_control_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct lwapp_control_header));
 
         lwapp_control_header = (const struct lwapp_control_header *)tptr;
        msg_tlen = EXTRACT_BE_U_2(lwapp_control_header->len);
@@ -236,7 +236,7 @@ lwapp_control_print(netdissect_options *ndo,
                EXTRACT_BE_U_4(lwapp_control_header->session_id)));
 
         /* did we capture enough for fully decoding the message */
-        ND_TCHECK2(*tptr, msg_tlen);
+        ND_TCHECK_LEN(tptr, msg_tlen);
 
        /* XXX - Decode sub messages for each message */
         switch(lwapp_control_header->msg_type) {
index ccd0302a4b88fb49fb36996eeae72a68189d52c4..51f3a7a689db57676c962dbc4fb0098e8e547ab8 100644 (file)
@@ -261,7 +261,7 @@ lwres_printaddr(netdissect_options *ndo,
        l = EXTRACT_BE_U_2(&ap->length);
        /* XXX ap points to packed struct */
        p = (const char *)&ap->length + sizeof(ap->length);
-       ND_TCHECK2(*p, l);
+       ND_TCHECK_LEN(p, l);
 
        switch (EXTRACT_BE_U_4(&ap->family)) {
        case 1: /* IPv4 */
index 163b645061eb24cbb5940a8dccd92613160fe876..c50ed0d4f62b2be7090c200972c954736c223c25 100644 (file)
@@ -219,19 +219,19 @@ tag_value_print(netdissect_options *ndo,
     /* buf and size don't include the header */
     if (size < 4)
       goto invalid;
-    ND_TCHECK2(*buf, size);
+    ND_TCHECK_LEN(buf, size);
     ND_PRINT((ndo, "0x%08x", EXTRACT_BE_U_4(buf)));
     break;
   /* ... */
   default:
     ND_PRINT((ndo, "(length %u)", size + (u_int)sizeof(struct m3ua_param_header)));
-    ND_TCHECK2(*buf, size);
+    ND_TCHECK_LEN(buf, size);
   }
   return;
 
 invalid:
   ND_PRINT((ndo, "%s", istr));
-  ND_TCHECK2(*buf, size);
+  ND_TCHECK_LEN(buf, size);
   return;
 trunc:
   ND_PRINT((ndo, "%s", tstr));
@@ -260,7 +260,7 @@ m3ua_tags_print(netdissect_options *ndo,
   while (p < buf + size) {
     if (p + sizeof(struct m3ua_param_header) > buf + size)
       goto invalid;
-    ND_TCHECK2(*p, sizeof(struct m3ua_param_header));
+    ND_TCHECK_LEN(p, sizeof(struct m3ua_param_header));
     /* Parameter Tag */
     hdr_tag = EXTRACT_BE_U_2(p);
     ND_PRINT((ndo, "\n\t\t\t%s: ", tok2str(ParamName, "Unknown Parameter (0x%04x)", hdr_tag)));
@@ -271,7 +271,7 @@ m3ua_tags_print(netdissect_options *ndo,
     /* Parameter Value */
     align = (p + hdr_len - buf) % 4;
     align = align ? 4 - align : 0;
-    ND_TCHECK2(*p, hdr_len + align);
+    ND_TCHECK_LEN(p, hdr_len + align);
     tag_value_print(ndo, p, hdr_tag, hdr_len - sizeof(struct m3ua_param_header));
     p += hdr_len + align;
   }
@@ -279,7 +279,7 @@ m3ua_tags_print(netdissect_options *ndo,
 
 invalid:
   ND_PRINT((ndo, "%s", istr));
-  ND_TCHECK2(*buf, size);
+  ND_TCHECK_LEN(buf, size);
   return;
 trunc:
   ND_PRINT((ndo, "%s", tstr));
@@ -332,7 +332,7 @@ m3ua_print(netdissect_options *ndo,
 
 invalid:
   ND_PRINT((ndo, "%s", istr));
-  ND_TCHECK2(*buf, size);
+  ND_TCHECK_LEN(buf, size);
   return;
 trunc:
   ND_PRINT((ndo, "%s", tstr));
index 1011917f2ad56a8f9d1c7079ceffeb4419993341..1f6446e39b1ca146ffb76f049f93dbc1b29f5954 100644 (file)
@@ -140,7 +140,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
     tptr=pptr;
     mpcp.common_header = (const struct mpcp_common_header_t *)pptr;
 
-    ND_TCHECK2(*tptr, sizeof(struct mpcp_common_header_t));
+    ND_TCHECK_LEN(tptr, sizeof(struct mpcp_common_header_t));
     opcode = EXTRACT_BE_U_2(mpcp.common_header->opcode);
     ND_PRINT((ndo, "MPCP, Opcode %s", tok2str(mpcp_opcode_values, "Unknown (%u)", opcode)));
     if (opcode != MPCP_OPCODE_PAUSE) {
@@ -158,7 +158,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         break;
 
     case MPCP_OPCODE_GATE:
-        ND_TCHECK2(*tptr, MPCP_GRANT_NUMBER_LEN);
+        ND_TCHECK_LEN(tptr, MPCP_GRANT_NUMBER_LEN);
         grant_numbers = EXTRACT_U_1(tptr) & MPCP_GRANT_NUMBER_MASK;
         ND_PRINT((ndo, "\n\tGrant Numbers %u, Flags [ %s ]",
                grant_numbers,
@@ -168,7 +168,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         tptr++;
 
         for (grant = 1; grant <= grant_numbers; grant++) {
-            ND_TCHECK2(*tptr, sizeof(struct mpcp_grant_t));
+            ND_TCHECK_LEN(tptr, sizeof(struct mpcp_grant_t));
             mpcp.grant = (const struct mpcp_grant_t *)tptr;
             ND_PRINT((ndo, "\n\tGrant #%u, Start-Time %u ticks, duration %u ticks",
                    grant,
@@ -177,19 +177,19 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
             tptr += sizeof(struct mpcp_grant_t);
         }
 
-        ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
+        ND_TCHECK_LEN(tptr, MPCP_TIMESTAMP_DURATION_LEN);
         ND_PRINT((ndo, "\n\tSync-Time %u ticks", EXTRACT_BE_U_2(tptr)));
         break;
 
 
     case MPCP_OPCODE_REPORT:
-        ND_TCHECK2(*tptr, MPCP_REPORT_QUEUESETS_LEN);
+        ND_TCHECK_LEN(tptr, MPCP_REPORT_QUEUESETS_LEN);
         queue_sets = EXTRACT_U_1(tptr);
         tptr+=MPCP_REPORT_QUEUESETS_LEN;
         ND_PRINT((ndo, "\n\tTotal Queue-Sets %u", queue_sets));
 
         for (queue_set = 1; queue_set < queue_sets; queue_set++) {
-            ND_TCHECK2(*tptr, MPCP_REPORT_REPORTBITMAP_LEN);
+            ND_TCHECK_LEN(tptr, MPCP_REPORT_REPORTBITMAP_LEN);
             report_bitmap = EXTRACT_U_1(tptr);
             ND_PRINT((ndo, "\n\t  Queue-Set #%u, Report-Bitmap [ %s ]",
                    queue_sets,
@@ -199,7 +199,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
             report=1;
             while (report_bitmap != 0) {
                 if (report_bitmap & 1) {
-                    ND_TCHECK2(*tptr, MPCP_TIMESTAMP_DURATION_LEN);
+                    ND_TCHECK_LEN(tptr, MPCP_TIMESTAMP_DURATION_LEN);
                     ND_PRINT((ndo, "\n\t    Q%u Report, Duration %u ticks",
                            report,
                            EXTRACT_BE_U_2(tptr)));
@@ -212,7 +212,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         break;
 
     case MPCP_OPCODE_REG_REQ:
-        ND_TCHECK2(*tptr, sizeof(struct mpcp_reg_req_t));
+        ND_TCHECK_LEN(tptr, sizeof(struct mpcp_reg_req_t));
         mpcp.reg_req = (const struct mpcp_reg_req_t *)tptr;
         ND_PRINT((ndo, "\n\tFlags [ %s ], Pending-Grants %u",
                bittok2str(mpcp_reg_req_flag_values, "Reserved", mpcp.reg_req->flags),
@@ -220,7 +220,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         break;
 
     case MPCP_OPCODE_REG:
-        ND_TCHECK2(*tptr, sizeof(struct mpcp_reg_t));
+        ND_TCHECK_LEN(tptr, sizeof(struct mpcp_reg_t));
         mpcp.reg = (const struct mpcp_reg_t *)tptr;
         ND_PRINT((ndo, "\n\tAssigned-Port %u, Flags [ %s ]" \
                "\n\tSync-Time %u ticks, Echoed-Pending-Grants %u",
@@ -231,7 +231,7 @@ mpcp_print(netdissect_options *ndo, register const u_char *pptr, register u_int
         break;
 
     case MPCP_OPCODE_REG_ACK:
-        ND_TCHECK2(*tptr, sizeof(struct mpcp_reg_ack_t));
+        ND_TCHECK_LEN(tptr, sizeof(struct mpcp_reg_ack_t));
         mpcp.reg_ack = (const struct mpcp_reg_ack_t *)tptr;
         ND_PRINT((ndo, "\n\tEchoed-Assigned-Port %u, Flags [ %s ]" \
                "\n\tEchoed-Sync-Time %u ticks",
index b156ef7fc5d6ffe2185bb04b0f4ffaf7b5f2a9fa..c566ea1421dea7763e24c77b3c05b4b2c305ad2e 100644 (file)
@@ -67,7 +67,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
        p = bp;
        ND_PRINT((ndo, "MPLS"));
        do {
-               ND_TCHECK2(*p, sizeof(label_entry));
+               ND_TCHECK_LEN(p, sizeof(label_entry));
                if (length < sizeof(label_entry)) {
                        ND_PRINT((ndo, "[|MPLS], length %u", length));
                        return;
index a4823842a7be7e365684eba865bfbf68b61ceda0..797f53ad9428559c5315feec83dc6c83dbbd3d61 100644 (file)
@@ -433,7 +433,7 @@ parsereq(netdissect_options *ndo,
                len = EXTRACT_BE_U_4(dp + 1);
                if (len < length) {
                        dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
-                       ND_TCHECK2(dp[0], 0);
+                       ND_TCHECK_LEN(dp, 0);
                        return (dp);
                }
        }
@@ -458,7 +458,7 @@ parsefh(netdissect_options *ndo,
        } else
                len = NFSX_V2FH / 4;
 
-       if (ND_TTEST2(*dp, len * sizeof(*dp))) {
+       if (ND_TTEST_LEN(dp, len * sizeof(*dp))) {
                nfs_printfh(ndo, dp, len);
                return (dp + len);
        }
@@ -484,7 +484,7 @@ parsefn(netdissect_options *ndo,
        len = *dp++;
        NTOHL(len);
 
-       ND_TCHECK2(*dp, ((len + 3) & ~3));
+       ND_TCHECK_LEN(dp, ((len + 3) & ~3));
 
        cp = (const u_char *)dp;
        /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */
@@ -1016,7 +1016,7 @@ parserep(netdissect_options *ndo,
                return (NULL);
        }
        /* successful return */
-       ND_TCHECK2(*dp, sizeof(astat));
+       ND_TCHECK_LEN(dp, sizeof(astat));
        return ((const uint32_t *) (sizeof(astat) + ((const char *)dp)));
 trunc:
        return (0);
@@ -1186,7 +1186,7 @@ parsestatfs(netdissect_options *ndo,
                        return (0);
        }
 
-       ND_TCHECK2(*dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
+       ND_TCHECK_LEN(dp, (v3 ? NFSX_V3STATFS : NFSX_V2STATFS));
 
        sfsp = (const struct nfs_statfs *)dp;
 
@@ -1264,7 +1264,7 @@ parse_pre_op_attr(netdissect_options *ndo,
        if (!EXTRACT_BE_U_4(dp))
                return (dp + 1);
        dp++;
-       ND_TCHECK2(*dp, 24);
+       ND_TCHECK_LEN(dp, 24);
        if (verbose > 1) {
                return parse_wcc_attr(ndo, dp);
        } else {
index b064482323a81f95c7011eed6f0f57280fbf9382..2734382ce1a95af5d33e535e6cbe6d8c8f579252 100644 (file)
@@ -66,7 +66,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len)
     if (len < NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN)
         goto trunc;
 
-    ND_TCHECK2(*bp, NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN);
+    ND_TCHECK_LEN(bp, NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN);
 
     ver = (uint8_t)(EXTRACT_U_1(bp) >> 6);
     flags = EXTRACT_U_1(bp);
@@ -101,7 +101,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len)
     if (len < length * NSH_HDR_WORD_SIZE)
         goto trunc;
 
-    ND_TCHECK2(*bp, length * NSH_HDR_WORD_SIZE);
+    ND_TCHECK_LEN(bp, length * NSH_HDR_WORD_SIZE);
 
     /*
      * length includes the lengths of the Base and Service Path headers.
index f2fbd1aa0d17a3651096701f57694591eb676b6e..9e571eb5ea5e494411fddf207ffece769aa51515 100644 (file)
@@ -373,7 +373,7 @@ ntp_time_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, " %s", istr));
-       ND_TCHECK2(*bp, length);
+       ND_TCHECK_LEN(bp, length);
        return;
 
 trunc:
@@ -433,7 +433,7 @@ ntp_control_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, " %s", istr));
-       ND_TCHECK2(*cd, length);
+       ND_TCHECK_LEN(cd, length);
        return;
 
 trunc:
index fdfe706bb1e205e24c966361e2993d5b23cd72b4..d307184d245ac9ac423f65aa44172f635e2e1b65 100644 (file)
@@ -292,7 +292,7 @@ olsr_print_neighbor(netdissect_options *ndo,
 
     while (hello_len >= sizeof(struct in_addr)) {
 
-        if (!ND_TTEST2(*msg_data, sizeof(struct in_addr)))
+        if (!ND_TTEST_LEN(msg_data, sizeof(struct in_addr)))
             return (-1);
         /* print 4 neighbors per line */
 
@@ -332,7 +332,7 @@ olsr_print(netdissect_options *ndo,
         goto trunc;
     }
 
-    ND_TCHECK2(*tptr, sizeof(struct olsr_common));
+    ND_TCHECK_LEN(tptr, sizeof(struct olsr_common));
 
     ptr.common = (const struct olsr_common *)tptr;
     length = min(length, EXTRACT_BE_U_2(ptr.common->packet_len));
@@ -361,7 +361,7 @@ olsr_print(netdissect_options *ndo,
 
         if (is_ipv6)
         {
-            ND_TCHECK2(*tptr, sizeof(struct olsr_msg6));
+            ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg6));
             msgptr.v6 = (const struct olsr_msg6 *) tptr;
             msg_type = msgptr.v6->msg_type;
             msg_len = EXTRACT_BE_U_2(msgptr.v6->msg_len);
@@ -392,7 +392,7 @@ olsr_print(netdissect_options *ndo,
         }
         else /* (!is_ipv6) */
         {
-            ND_TCHECK2(*tptr, sizeof(struct olsr_msg4));
+            ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg4));
             msgptr.v4 = (const struct olsr_msg4 *) tptr;
             msg_type = msgptr.v4->msg_type;
             msg_len = EXTRACT_BE_U_2(msgptr.v4->msg_len);
@@ -427,7 +427,7 @@ olsr_print(netdissect_options *ndo,
         case OLSR_HELLO_LQ_MSG:
             if (msg_tlen < sizeof(struct olsr_hello))
                 goto trunc;
-            ND_TCHECK2(*msg_data, sizeof(struct olsr_hello));
+            ND_TCHECK_LEN(msg_data, sizeof(struct olsr_hello));
 
             ptr.hello = (const struct olsr_hello *)msg_data;
             ND_PRINT((ndo, "\n\t  hello-time %.3fs, MPR willingness %u",
@@ -441,7 +441,7 @@ olsr_print(netdissect_options *ndo,
                 /*
                  * link-type.
                  */
-                ND_TCHECK2(*msg_data, sizeof(struct olsr_hello_link));
+                ND_TCHECK_LEN(msg_data, sizeof(struct olsr_hello_link));
 
                 ptr.hello_link = (const struct olsr_hello_link *)msg_data;
 
@@ -466,7 +466,7 @@ olsr_print(netdissect_options *ndo,
                 msg_tlen -= sizeof(struct olsr_hello_link);
                 hello_len -= sizeof(struct olsr_hello_link);
 
-                ND_TCHECK2(*msg_data, hello_len);
+                ND_TCHECK_LEN(msg_data, hello_len);
                 if (msg_type == OLSR_HELLO_MSG) {
                     if (olsr_print_neighbor(ndo, msg_data, hello_len) == -1)
                         goto trunc;
@@ -489,7 +489,7 @@ olsr_print(netdissect_options *ndo,
         case OLSR_TC_LQ_MSG:
             if (msg_tlen < sizeof(struct olsr_tc))
                 goto trunc;
-            ND_TCHECK2(*msg_data, sizeof(struct olsr_tc));
+            ND_TCHECK_LEN(msg_data, sizeof(struct olsr_tc));
 
             ptr.tc = (const struct olsr_tc *)msg_data;
             ND_PRINT((ndo, "\n\t    advertised neighbor seq 0x%04x",
@@ -519,7 +519,7 @@ olsr_print(netdissect_options *ndo,
                 addr_size = sizeof(struct in6_addr);
 
             while (msg_tlen >= addr_size) {
-                ND_TCHECK2(*msg_data, addr_size);
+                ND_TCHECK_LEN(msg_data, addr_size);
                 ND_PRINT((ndo, "\n\t  interface address %s",
                         is_ipv6 ? ip6addr_string(ndo, msg_data) :
                         ipaddr_string(ndo, msg_data)));
@@ -541,7 +541,7 @@ olsr_print(netdissect_options *ndo,
                 while (msg_tlen >= sizeof(struct olsr_hna6)) {
                     const struct olsr_hna6 *hna6;
 
-                    ND_TCHECK2(*msg_data, sizeof(struct olsr_hna6));
+                    ND_TCHECK_LEN(msg_data, sizeof(struct olsr_hna6));
 
                     hna6 = (const struct olsr_hna6 *)msg_data;
 
@@ -561,7 +561,7 @@ olsr_print(netdissect_options *ndo,
                         (unsigned int) (msg_tlen / sizeof(struct olsr_hna4))));
 
                 while (msg_tlen >= sizeof(struct olsr_hna4)) {
-                    ND_TCHECK2(*msg_data, sizeof(struct olsr_hna4));
+                    ND_TCHECK_LEN(msg_data, sizeof(struct olsr_hna4));
 
                     ptr.hna = (const struct olsr_hna4 *)msg_data;
 
@@ -676,7 +676,8 @@ olsr_print(netdissect_options *ndo,
                 if (msg_tlen < addr_size + name_entry_len + name_entry_padding)
                     goto trunc;
 
-                ND_TCHECK2(*msg_data, addr_size + name_entry_len + name_entry_padding);
+                ND_TCHECK_LEN(msg_data,
+                              addr_size + name_entry_len + name_entry_padding);
 
                 if (is_ipv6)
                     ND_PRINT((ndo, ", address %s, name \"",
index adab701f2d154f3276e14e69297929b3072a2c23..ec9b6a187595583669f34a0a9b676076f0d02a8b 100644 (file)
@@ -742,7 +742,7 @@ of10_data_print(netdissect_options *ndo,
                return cp;
        /* data */
        ND_PRINT((ndo, "\n\t data (%u octets)", len));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        if (ndo->ndo_vflag >= 2)
                hex_and_ascii_print(ndo, "\n\t  ", cp, len);
        return cp + len;
@@ -943,14 +943,14 @@ of10_bsn_message_print(netdissect_options *ndo,
                cp += 4;
                break;
        default:
-               ND_TCHECK2(*cp, len - 4);
+               ND_TCHECK_LEN(cp, len - 4);
                cp += len - 4;
        }
        return cp;
 
 invalid: /* skip the undersized data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len);
+       ND_TCHECK_LEN(cp0, len);
        return cp0 + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1016,7 +1016,7 @@ of10_bsn_actions_print(netdissect_options *ndo,
                cp += 3;
                break;
        default:
-               ND_TCHECK2(*cp, len - 4);
+               ND_TCHECK_LEN(cp, len - 4);
                cp += len - 4;
        }
 
@@ -1024,7 +1024,7 @@ of10_bsn_actions_print(netdissect_options *ndo,
 
 invalid:
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len);
+       ND_TCHECK_LEN(cp0, len);
        return cp0 + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1053,7 +1053,7 @@ of10_vendor_action_print(netdissect_options *ndo,
 
 invalid: /* skip the undersized data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        return cp + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1082,7 +1082,7 @@ of10_vendor_message_print(netdissect_options *ndo,
 
 invalid: /* skip the undersized data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        return cp + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1108,7 +1108,7 @@ of10_vendor_data_print(netdissect_options *ndo,
 
 invalid: /* skip the undersized data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        return cp + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1125,7 +1125,7 @@ of10_packet_data_print(netdissect_options *ndo,
        ND_PRINT((ndo, "\n\t data (%u octets)", len));
        if (ndo->ndo_vflag < 3)
                return cp + len;
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        ndo->ndo_vflag -= 3;
        ND_PRINT((ndo, ", frame decoding below\n"));
        ether_print(ndo, cp, len, ndo->ndo_snapend - cp, NULL, NULL);
@@ -1153,18 +1153,18 @@ of10_phy_ports_print(netdissect_options *ndo,
                ND_PRINT((ndo, "\n\t  port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
                cp += 2;
                /* hw_addr */
-               ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+               ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
                ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(ndo, cp)));
                cp += ETHER_ADDR_LEN;
                /* name */
-               ND_TCHECK2(*cp, OFP_MAX_PORT_NAME_LEN);
+               ND_TCHECK_LEN(cp, OFP_MAX_PORT_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
                fn_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN);
                ND_PRINT((ndo, "'"));
                cp += OFP_MAX_PORT_NAME_LEN;
 
                if (ndo->ndo_vflag < 2) {
-                       ND_TCHECK2(*cp, 24);
+                       ND_TCHECK_LEN(cp, 24);
                        cp += 24;
                        goto next_port;
                }
@@ -1211,7 +1211,7 @@ next_port:
 
 invalid: /* skip the undersized trailing data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1263,7 +1263,7 @@ of10_queue_props_print(netdissect_options *ndo,
                        skip = 1;
                }
                if (skip) {
-                       ND_TCHECK2(*cp, plen - 4);
+                       ND_TCHECK_LEN(cp, plen - 4);
                        cp += plen - 4;
                        goto next_property;
                }
@@ -1287,7 +1287,7 @@ next_property:
 
 invalid: /* skip the rest of queue properties */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1322,7 +1322,7 @@ of10_queues_print(netdissect_options *ndo,
                cp += 2;
                /* properties */
                if (ndo->ndo_vflag < 2) {
-                       ND_TCHECK2(*cp, desclen - OF_PACKET_QUEUE_LEN);
+                       ND_TCHECK_LEN(cp, desclen - OF_PACKET_QUEUE_LEN);
                        cp += desclen - OF_PACKET_QUEUE_LEN;
                        goto next_queue;
                }
@@ -1335,7 +1335,7 @@ next_queue:
 
 invalid: /* skip the rest of queues */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1365,12 +1365,12 @@ of10_match_print(netdissect_options *ndo,
                ND_PRINT((ndo, "%smatch in_port %s", pfx, tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
        cp += 2;
        /* dl_src */
-       ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+       ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
        if (! (wildcards & OFPFW_DL_SRC))
                ND_PRINT((ndo, "%smatch dl_src %s", pfx, etheraddr_string(ndo, cp)));
        cp += ETHER_ADDR_LEN;
        /* dl_dst */
-       ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+       ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
        if (! (wildcards & OFPFW_DL_DST))
                ND_PRINT((ndo, "%smatch dl_dst %s", pfx, etheraddr_string(ndo, cp)));
        cp += ETHER_ADDR_LEN;
@@ -1504,7 +1504,7 @@ of10_actions_print(netdissect_options *ndo,
                        skip = 1;
                }
                if (skip) {
-                       ND_TCHECK2(*cp, alen - 4);
+                       ND_TCHECK_LEN(cp, alen - 4);
                        cp += alen - 4;
                        goto next_action;
                }
@@ -1543,7 +1543,7 @@ of10_actions_print(netdissect_options *ndo,
                case OFPAT_SET_DL_SRC:
                case OFPAT_SET_DL_DST:
                        /* dl_addr */
-                       ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+                       ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
                        ND_PRINT((ndo, ", dl_addr %s", etheraddr_string(ndo, cp)));
                        cp += ETHER_ADDR_LEN;
                        /* pad */
@@ -1606,7 +1606,7 @@ next_action:
 
 invalid: /* skip the rest of actions */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1720,7 +1720,7 @@ of10_port_mod_print(netdissect_options *ndo,
        ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
        cp += 2;
        /* hw_addr */
-       ND_TCHECK2(*cp, ETHER_ADDR_LEN);
+       ND_TCHECK_LEN(cp, ETHER_ADDR_LEN);
        ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(ndo, cp)));
        cp += ETHER_ADDR_LEN;
        /* config */
@@ -1824,7 +1824,7 @@ of10_stats_request_print(netdissect_options *ndo,
 
 invalid: /* skip the message body */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1839,31 +1839,31 @@ of10_desc_stats_reply_print(netdissect_options *ndo,
        if (len != OF_DESC_STATS_LEN)
                goto invalid;
        /* mfr_desc */
-       ND_TCHECK2(*cp, DESC_STR_LEN);
+       ND_TCHECK_LEN(cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  mfr_desc '"));
        fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* hw_desc */
-       ND_TCHECK2(*cp, DESC_STR_LEN);
+       ND_TCHECK_LEN(cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  hw_desc '"));
        fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* sw_desc */
-       ND_TCHECK2(*cp, DESC_STR_LEN);
+       ND_TCHECK_LEN(cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  sw_desc '"));
        fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
        cp += DESC_STR_LEN;
        /* serial_num */
-       ND_TCHECK2(*cp, SERIAL_NUM_LEN);
+       ND_TCHECK_LEN(cp, SERIAL_NUM_LEN);
        ND_PRINT((ndo, "\n\t  serial_num '"));
        fn_print(ndo, cp, cp + SERIAL_NUM_LEN);
        ND_PRINT((ndo, "'"));
        cp += SERIAL_NUM_LEN;
        /* dp_desc */
-       ND_TCHECK2(*cp, DESC_STR_LEN);
+       ND_TCHECK_LEN(cp, DESC_STR_LEN);
        ND_PRINT((ndo, "\n\t  dp_desc '"));
        fn_print(ndo, cp, cp + DESC_STR_LEN);
        ND_PRINT((ndo, "'"));
@@ -1871,7 +1871,7 @@ of10_desc_stats_reply_print(netdissect_options *ndo,
 
 invalid: /* skip the message body */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        return cp + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1952,7 +1952,7 @@ of10_flow_stats_reply_print(netdissect_options *ndo,
 
 invalid: /* skip the rest of flow statistics entries */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -1985,7 +1985,7 @@ of10_aggregate_stats_reply_print(netdissect_options *ndo,
 
 invalid: /* skip the message body */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, len);
+       ND_TCHECK_LEN(cp, len);
        return cp + len;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -2011,7 +2011,7 @@ of10_table_stats_reply_print(netdissect_options *ndo,
                ND_TCHECK_3(cp);
                cp += 3;
                /* name */
-               ND_TCHECK2(*cp, OFP_MAX_TABLE_NAME_LEN);
+               ND_TCHECK_LEN(cp, OFP_MAX_TABLE_NAME_LEN);
                ND_PRINT((ndo, ", name '"));
                fn_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN);
                ND_PRINT((ndo, "'"));
@@ -2045,7 +2045,7 @@ of10_table_stats_reply_print(netdissect_options *ndo,
 
 invalid: /* skip the undersized trailing data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -2068,7 +2068,7 @@ of10_port_stats_reply_print(netdissect_options *ndo,
                ND_PRINT((ndo, "\n\t  port_no %s", tok2str(ofpp_str, "%u", EXTRACT_BE_U_2(cp))));
                cp += 2;
                if (ndo->ndo_vflag < 2) {
-                       ND_TCHECK2(*cp, OF_PORT_STATS_LEN - 2);
+                       ND_TCHECK_LEN(cp, OF_PORT_STATS_LEN - 2);
                        cp += OF_PORT_STATS_LEN - 2;
                        goto next_port;
                }
@@ -2130,7 +2130,7 @@ next_port:
 
 invalid: /* skip the undersized trailing data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -2178,7 +2178,7 @@ of10_queue_stats_reply_print(netdissect_options *ndo,
 
 invalid: /* skip the undersized trailing data */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -2218,7 +2218,7 @@ of10_stats_reply_print(netdissect_options *ndo,
                if (decoder != NULL)
                        return decoder(ndo, cp, ep, len - OF_STATS_REPLY_LEN);
        }
-       ND_TCHECK2(*cp0, len);
+       ND_TCHECK_LEN(cp0, len);
        return cp0 + len;
 
 trunc:
@@ -2257,7 +2257,7 @@ of10_packet_out_print(netdissect_options *ndo,
 
 invalid: /* skip the rest of the message body */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp0, len0);
+       ND_TCHECK_LEN(cp0, len0);
        return cp0 + len0;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
@@ -2561,7 +2561,7 @@ of10_header_body_print(netdissect_options *ndo,
 invalid: /* skip the message body */
        ND_PRINT((ndo, "%s", istr));
 next_message:
-       ND_TCHECK2(*cp0, len0 - OF_HEADER_LEN);
+       ND_TCHECK_LEN(cp0, len0 - OF_HEADER_LEN);
        return cp0 + len0 - OF_HEADER_LEN;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
index 687b16d60c42b29b4d3a7dc7c51eed0c7cc889c3..3ef914323460702018225498f83d97621879678f 100644 (file)
@@ -116,13 +116,13 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep
                return of10_header_body_print(ndo, cp, ep, type, length, xid);
        default:
                of_header_print(ndo, version, type, length, xid);
-               ND_TCHECK2(*cp, length - OF_HEADER_LEN);
+               ND_TCHECK_LEN(cp, length - OF_HEADER_LEN);
                return cp + length - OF_HEADER_LEN; /* done with current message */
        }
 
 invalid: /* fail current packet */
        ND_PRINT((ndo, "%s", istr));
-       ND_TCHECK2(*cp, ep - cp);
+       ND_TCHECK_LEN(cp, ep - cp);
        return ep;
 trunc:
        ND_PRINT((ndo, "%s", tstr));
index ea6abaab151331fd288e809b480bf139dc452d3a..4453a47e3bee024a59596d452346e8037a6957a1 100644 (file)
@@ -213,7 +213,7 @@ ospf_print_grace_lsa(netdissect_options *ndo,
             return -1;
         }
 
-        ND_TCHECK2(*tptr, tlv_length);
+        ND_TCHECK_LEN(tptr, tlv_length);
         switch(tlv_type) {
 
         case LS_OPAQUE_GRACE_TLV_PERIOD:
@@ -323,7 +323,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
                        subtlv_type,
                        subtlv_length));
 
-                ND_TCHECK2(*tptr, subtlv_length);
+                ND_TCHECK_LEN(tptr, subtlv_length);
                 switch(subtlv_type) {
                 case LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP:
                    if (subtlv_length != 4) {
@@ -823,7 +823,7 @@ ospf_print_lsa(netdissect_options *ndo,
                             ls_length));
                         return(ls_end);
                     }
-                    ND_TCHECK2(*tptr, tlv_length);
+                    ND_TCHECK_LEN(tptr, tlv_length);
                     switch(tlv_type) {
 
                     case LS_OPAQUE_RI_TLV_CAP:
@@ -1150,7 +1150,7 @@ ospf_print(netdissect_options *ndo,
 
        if (ndo->ndo_vflag) {
                /* Print authentication data (should we really do this?) */
-               ND_TCHECK2(op->ospf_authdata[0], sizeof(op->ospf_authdata));
+               ND_TCHECK_LEN(op->ospf_authdata, sizeof(op->ospf_authdata));
 
                ND_PRINT((ndo, ", Authentication Type: %s (%u)",
                          tok2str(ospf_authtype_values, "unknown", EXTRACT_BE_U_2(&op->ospf_authtype)),
index b08aa50e33e4682f14b53497dc0f86e700917eec..68c6ee03342cf144bccff914d60ddd5e1da83539 100644 (file)
@@ -417,7 +417,7 @@ ospf6_print_lsaprefix(netdissect_options *ndo,
        if (lsa_length < sizeof (*lsapp) - IPV6_ADDR_LEN_BYTES)
                goto trunc;
        lsa_length -= sizeof (*lsapp) - IPV6_ADDR_LEN_BYTES;
-       ND_TCHECK2(*lsapp, sizeof (*lsapp) - IPV6_ADDR_LEN_BYTES);
+       ND_TCHECK_LEN(lsapp, sizeof(*lsapp) - IPV6_ADDR_LEN_BYTES);
        wordlen = (lsapp->lsa_p_len + 31) / 32;
        if (wordlen * 4 > sizeof(struct in6_addr)) {
                ND_PRINT((ndo, " bogus prefixlen /%d", lsapp->lsa_p_len));
@@ -867,7 +867,7 @@ ospf6_print_lls(netdissect_options *ndo,
                goto trunc;
        cp += 2;
        /* LLS TLVs */
-       ND_TCHECK2(*cp, llsdatalen - OSPF_LLS_HDRLEN);
+       ND_TCHECK_LEN(cp, llsdatalen - OSPF_LLS_HDRLEN);
        /* FIXME: code in print-ospf.c can be reused to decode the TLVs */
 
        return llsdatalen;
@@ -913,7 +913,7 @@ ospf6_decode_at(netdissect_options *ndo,
        ND_PRINT((ndo, ":%08x", EXTRACT_BE_U_4(cp)));
        cp += 4;
        /* Authentication Data */
-       ND_TCHECK2(*cp, authdatalen - OSPF6_AT_HDRLEN);
+       ND_TCHECK_LEN(cp, authdatalen - OSPF6_AT_HDRLEN);
        if (ndo->ndo_vflag > 1)
                print_unknown_data(ndo,cp, "\n\tAuthentication Data ", authdatalen - OSPF6_AT_HDRLEN);
        return 0;
index e5701ff0e0cc7c270520bb495b7c435c36f9b8c0..16735f5d6be0952937fd014a0129eb2b76cd9b24 100644 (file)
@@ -228,12 +228,12 @@ pgm_print(netdissect_options *ndo,
 
            switch (EXTRACT_BE_U_2(&spm->pgms_nla_afi)) {
            case AFNUM_INET:
-               ND_TCHECK2(*bp, sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                addrtostr(bp, nla_buf, sizeof(nla_buf));
                bp += sizeof(struct in_addr);
                break;
            case AFNUM_INET6:
-               ND_TCHECK2(*bp, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                addrtostr6(bp, nla_buf, sizeof(nla_buf));
                bp += sizeof(struct in6_addr);
                break;
@@ -271,12 +271,12 @@ pgm_print(netdissect_options *ndo,
 
            switch (EXTRACT_BE_U_2(&polr->pgmp_nla_afi)) {
            case AFNUM_INET:
-               ND_TCHECK2(*bp, sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                addrtostr(bp, nla_buf, sizeof(nla_buf));
                bp += sizeof(struct in_addr);
                break;
            case AFNUM_INET6:
-               ND_TCHECK2(*bp, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                addrtostr6(bp, nla_buf, sizeof(nla_buf));
                bp += sizeof(struct in6_addr);
                break;
@@ -285,15 +285,15 @@ pgm_print(netdissect_options *ndo,
                break;
            }
 
-           ND_TCHECK2(*bp, sizeof(uint32_t));
+           ND_TCHECK_LEN(bp, sizeof(uint32_t));
            ivl = EXTRACT_BE_U_4(bp);
            bp += sizeof(uint32_t);
 
-           ND_TCHECK2(*bp, sizeof(uint32_t));
+           ND_TCHECK_LEN(bp, sizeof(uint32_t));
            rnd = EXTRACT_BE_U_4(bp);
            bp += sizeof(uint32_t);
 
-           ND_TCHECK2(*bp, sizeof(uint32_t));
+           ND_TCHECK_LEN(bp, sizeof(uint32_t));
            mask = EXTRACT_BE_U_4(bp);
            bp += sizeof(uint32_t);
 
@@ -342,12 +342,12 @@ pgm_print(netdissect_options *ndo,
             */
            switch (EXTRACT_BE_U_2(&nak->pgmn_source_afi)) {
            case AFNUM_INET:
-               ND_TCHECK2(*bp, sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                addrtostr(bp, source_buf, sizeof(source_buf));
                bp += sizeof(struct in_addr);
                break;
            case AFNUM_INET6:
-               ND_TCHECK2(*bp, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                addrtostr6(bp, source_buf, sizeof(source_buf));
                bp += sizeof(struct in6_addr);
                break;
@@ -364,12 +364,12 @@ pgm_print(netdissect_options *ndo,
            ND_TCHECK_2(bp);
            switch (EXTRACT_BE_U_2(bp)) {
            case AFNUM_INET:
-               ND_TCHECK2(*bp, sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                addrtostr(bp, group_buf, sizeof(group_buf));
                bp += sizeof(struct in_addr);
                break;
            case AFNUM_INET6:
-               ND_TCHECK2(*bp, sizeof(struct in6_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                addrtostr6(bp, group_buf, sizeof(group_buf));
                bp += sizeof(struct in6_addr);
                break;
@@ -424,7 +424,7 @@ pgm_print(netdissect_options *ndo,
            /*
             * make sure there's enough for the first option header
             */
-           if (!ND_TTEST2(*bp, PGM_MIN_OPT_LEN)) {
+           if (!ND_TTEST_LEN(bp, PGM_MIN_OPT_LEN)) {
                ND_PRINT((ndo, "[|OPT]"));
                return;
            }
@@ -476,7 +476,7 @@ pgm_print(netdissect_options *ndo,
                    ND_PRINT((ndo, "[Total option length leaves no room for final option]"));
                    return;
                }
-               if (!ND_TTEST2(*bp, opt_len - 2)) {
+               if (!ND_TTEST_LEN(bp, opt_len - 2)) {
                    ND_PRINT((ndo, " [|OPT]"));
                    return;
                }
@@ -592,7 +592,7 @@ pgm_print(netdissect_options *ndo,
                                opt_len, PGM_OPT_REDIRECT_FIXED_LEN));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                        addrtostr(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in_addr);
                        opts_len -= PGM_OPT_REDIRECT_FIXED_LEN + sizeof(struct in_addr);
@@ -603,7 +603,7 @@ pgm_print(netdissect_options *ndo,
                                PGM_OPT_REDIRECT_FIXED_LEN, opt_len));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in6_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                        addrtostr6(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in6_addr);
                        opts_len -= PGM_OPT_REDIRECT_FIXED_LEN + sizeof(struct in6_addr);
@@ -749,7 +749,7 @@ pgm_print(netdissect_options *ndo,
                                opt_len, PGM_OPT_PGMCC_DATA_FIXED_LEN));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                        addrtostr(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in_addr);
                        opts_len -= PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(struct in_addr);
@@ -760,7 +760,7 @@ pgm_print(netdissect_options *ndo,
                                opt_len, PGM_OPT_PGMCC_DATA_FIXED_LEN));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in6_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                        addrtostr6(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in6_addr);
                        opts_len -= PGM_OPT_PGMCC_DATA_FIXED_LEN + sizeof(struct in6_addr);
@@ -792,7 +792,7 @@ pgm_print(netdissect_options *ndo,
                                opt_len, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                        addrtostr(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in_addr);
                        opts_len -= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(struct in_addr);
@@ -803,7 +803,7 @@ pgm_print(netdissect_options *ndo,
                                opt_len, PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN));
                            return;
                        }
-                       ND_TCHECK2(*bp, sizeof(struct in6_addr));
+                       ND_TCHECK_LEN(bp, sizeof(struct in6_addr));
                        addrtostr6(bp, nla_buf, sizeof(nla_buf));
                        bp += sizeof(struct in6_addr);
                        opts_len -= PGM_OPT_PGMCC_FEEDBACK_FIXED_LEN + sizeof(struct in6_addr);
index 26e3356be60dfdc62efac3570bf483c342a0a6d1..c479c7b0e22411716c5882195bcb4e84ffe0f252 100644 (file)
@@ -147,7 +147,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
        int njp;
 
        /* If it's a single group and a single source, use 1-line output. */
-       if (ND_TTEST2(bp[0], 30) && EXTRACT_U_1(bp + 11) == 1 &&
+       if (ND_TTEST_LEN(bp, 30) && EXTRACT_U_1(bp + 11) == 1 &&
            ((njoin = EXTRACT_BE_U_2(bp + 20)) + EXTRACT_BE_U_2(bp + 22)) == 1) {
                int hold;
 
@@ -171,7 +171,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
 
        if (len < sizeof(struct in_addr))
                goto trunc;
-       ND_TCHECK2(bp[0], sizeof(struct in_addr));
+       ND_TCHECK_LEN(bp, sizeof(struct in_addr));
        if (ndo->ndo_vflag > 1)
                ND_PRINT((ndo, "\n"));
        ND_PRINT((ndo, " Upstream Nbr: %s", ipaddr_string(ndo, bp)));
@@ -202,13 +202,13 @@ pimv1_join_prune_print(netdissect_options *ndo,
                 */
                if (len < 4)
                        goto trunc;
-               ND_TCHECK2(bp[0], sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                ND_PRINT((ndo, "\n\tGroup: %s", ipaddr_string(ndo, bp)));
                bp += 4;
                len -= 4;
                if (len < 4)
                        goto trunc;
-               ND_TCHECK2(bp[0], sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp, sizeof(struct in_addr));
                if (EXTRACT_BE_U_4(bp) != 0xffffffff)
                        ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp)));
                bp += 4;
@@ -284,12 +284,12 @@ pimv1_print(netdissect_options *ndo,
                break;
 
        case PIMV1_TYPE_REGISTER:
-               ND_TCHECK2(bp[8], 20);                  /* ip header */
+               ND_TCHECK_LEN(bp + 8, 20);                      /* ip header */
                ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 20),
                          ipaddr_string(ndo, bp + 24)));
                break;
        case PIMV1_TYPE_REGISTER_STOP:
-               ND_TCHECK2(bp[12], sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp + 12, sizeof(struct in_addr));
                ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 8),
                          ipaddr_string(ndo, bp + 12)));
                break;
@@ -304,7 +304,7 @@ pimv1_print(netdissect_options *ndo,
                }
                break;
        case PIMV1_TYPE_ASSERT:
-               ND_TCHECK2(bp[16], sizeof(struct in_addr));
+               ND_TCHECK_LEN(bp + 16, sizeof(struct in_addr));
                ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 16),
                          ipaddr_string(ndo, bp + 8)));
                if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff)
@@ -603,7 +603,7 @@ pimv2_addr_print(netdissect_options *ndo,
        case pimv2_unicast:
                if (len < addr_len)
                        goto trunc;
-               ND_TCHECK2(bp[0], addr_len);
+               ND_TCHECK_LEN(bp, addr_len);
                if (af == AF_INET) {
                        if (!silent)
                                ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp)));
@@ -617,7 +617,7 @@ pimv2_addr_print(netdissect_options *ndo,
        case pimv2_source:
                if (len < addr_len + 2)
                        goto trunc;
-               ND_TCHECK2(bp[0], addr_len + 2);
+               ND_TCHECK_LEN(bp, addr_len + 2);
                if (af == AF_INET) {
                        if (!silent) {
                                ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp + 2)));
@@ -667,7 +667,7 @@ pimv2_check_checksum(netdissect_options *ndo, const u_char *bp,
        const struct ip *ip;
        u_int cksum;
 
-       if (!ND_TTEST2(bp[0], len)) {
+       if (!ND_TTEST_LEN(bp, len)) {
                /* We don't have all the data. */
                return (UNVERIFIED);
        }
@@ -771,7 +771,7 @@ pimv2_print(netdissect_options *ndo,
 
                        if (len < olen)
                                goto trunc;
-                       ND_TCHECK2(bp[0], olen);
+                       ND_TCHECK_LEN(bp, olen);
                        switch (otype) {
                        case PIMV2_HELLO_OPTION_HOLDTIME:
                                if (olen != 2) {
@@ -874,7 +874,7 @@ pimv2_print(netdissect_options *ndo,
 
                if (len < 4)
                        goto trunc;
-               ND_TCHECK2(*bp, PIMV2_REGISTER_FLAG_LEN);
+               ND_TCHECK_LEN(bp, PIMV2_REGISTER_FLAG_LEN);
 
                ND_PRINT((ndo, ", Flags [ %s ]\n\t",
                          tok2str(pimv2_register_flag_values,
index bb8d660cb49aea7564354967f6acd512d8d3c388..a79906f83eb4c7136669ee8d4087e7588a54ef57 100644 (file)
@@ -549,7 +549,7 @@ handle_ctrl_proto(netdissect_options *ndo,
                /* XXX: need to decode Data? - hexdump for now */
                if (len > 8) {
                        ND_PRINT((ndo, "\n\t  -----trailing data-----"));
-                       ND_TCHECK2(tptr[4], len - 8);
+                       ND_TCHECK_LEN(tptr + 4, len - 8);
                        print_unknown_data(ndo, tptr + 4, "\n\t  ", len - 8);
                }
                break;
@@ -1100,7 +1100,7 @@ print_ipcp_config_options(netdissect_options *ndo,
                                return 0;
                         }
 
-                        ND_TCHECK2(*(p + 2), IPCPOPT_IPCOMP_MINLEN);
+                        ND_TCHECK_LEN(p + 2, IPCPOPT_IPCOMP_MINLEN);
                         ND_PRINT((ndo, "\n\t    TCP Space %u, non-TCP Space %u" \
                                ", maxPeriod %u, maxTime %u, maxHdr %u",
                                EXTRACT_BE_U_2(p + 4),
index 18baba9cb4da26ca80b7f38282171ec35c16d601..b2efcc321eaca619ae2a86d1e4c04735b4dcda41 100644 (file)
@@ -103,7 +103,7 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length)
        }
        length -= PPPOE_HDRLEN;
        pppoe_packet = bp;
-       ND_TCHECK2(*pppoe_packet, PPPOE_HDRLEN);
+       ND_TCHECK_LEN(pppoe_packet, PPPOE_HDRLEN);
        pppoe_ver  = (EXTRACT_U_1(pppoe_packet) & 0xF0) >> 4;
        pppoe_type  = (EXTRACT_U_1(pppoe_packet) & 0x0F);
        pppoe_code = EXTRACT_U_1(pppoe_packet + 1);
@@ -154,7 +154,7 @@ pppoe_print(netdissect_options *ndo, register const u_char *bp, u_int length)
                                unsigned tag_str_len = 0;
 
                                /* TODO print UTF-8 decoded text */
-                               ND_TCHECK2(*p, tag_len);
+                               ND_TCHECK_LEN(p, tag_len);
                                for (v = p; v < p + tag_len && tag_str_len < MAXTAGPRINT-1; v++)
                                        if (ND_ISPRINT(EXTRACT_U_1(v))) {
                                                tag_str[tag_str_len++] = EXTRACT_U_1(v);
index fda7710ca191119c7cd9b8effac35af9c536b8d9..904f659495af7beedf653a5f88badec0c6252266 100644 (file)
@@ -586,7 +586,7 @@ print_attr_string(netdissect_options *ndo,
 {
    register u_int i;
 
-   ND_TCHECK2(data[0],length);
+   ND_TCHECK_LEN(data, length);
 
    switch(attr_code)
    {
@@ -687,7 +687,7 @@ print_vendor_attr(netdissect_options *ndo,
         data+=2;
         vendor_length-=2;
         length-=2;
-       ND_TCHECK2(*data, vendor_length);
+       ND_TCHECK_LEN(data, vendor_length);
 
         ND_PRINT((ndo, "\n\t    Vendor Attribute: %u, Length: %u, Value: ",
                vendor_type,
@@ -906,7 +906,7 @@ print_attr_netmask6(netdissect_options *ndo,
        ND_PRINT((ndo, "ERROR: length %u not in range (2..18)", length));
        return;
    }
-   ND_TCHECK2(data[0], length);
+   ND_TCHECK_LEN(data, length);
    if (EXTRACT_U_1(data + 1) > 128)
    {
       ND_PRINT((ndo, "ERROR: netmask %u not in range (0..128)", EXTRACT_U_1(data + 1)));
@@ -1121,7 +1121,7 @@ radius_print(netdissect_options *ndo,
    register const struct radius_hdr *rad;
    u_int len, auth_idx;
 
-   ND_TCHECK2(*dat, MIN_RADIUS_LEN);
+   ND_TCHECK_LEN(dat, MIN_RADIUS_LEN);
    rad = (const struct radius_hdr *)dat;
    len = EXTRACT_BE_U_2(&rad->len);
 
index 64484601f5db2adf9cd4b64ea48124bfb25d4dc9..736b933eeed246dc5374acb31d740162606e85b8 100644 (file)
@@ -337,7 +337,7 @@ resp_print_bulk_string(netdissect_options *ndo, register const u_char *bp, int l
             resp_print_empty(ndo);
         else {
             LCHECK2(length_cur, string_len);
-            ND_TCHECK2(*bp, string_len);
+            ND_TCHECK_LEN(bp, string_len);
             RESP_PRINT_SEGMENT(ndo, bp, string_len);
             bp += string_len;
             length_cur -= string_len;
index 4e2e7c1461b79ca2223ea56138e734d06c7f5c89..47a131146929da514428a65d388f0e2f59eb3ef9 100644 (file)
@@ -197,7 +197,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
        ND_PRINT((ndo, "(%u bytes is too few to decode)", len));
        goto invalid;
     }
-    ND_TCHECK2(*tptr, sizeof(rpki_rtr_pdu));
+    ND_TCHECK_LEN(tptr, sizeof(rpki_rtr_pdu));
     pdu_header = (const rpki_rtr_pdu *)tptr;
     pdu_type = pdu_header->pdu_type;
     pdu_len = EXTRACT_BE_U_4(pdu_header->length);
@@ -225,7 +225,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
     case RPKI_RTR_END_OF_DATA_PDU:
        if (pdu_len != sizeof(rpki_rtr_pdu) + 4)
            goto invalid;
-       ND_TCHECK2(*tptr, pdu_len);
+       ND_TCHECK_LEN(tptr, pdu_len);
         msg = (const u_char *)(pdu_header + 1);
        ND_PRINT((ndo, "%sSession ID: 0x%04x, Serial: %u",
               indent_string(indent+2),
@@ -262,7 +262,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
 
            if (pdu_len != sizeof(rpki_rtr_pdu) + 12)
                goto invalid;
-           ND_TCHECK2(*tptr, pdu_len);
+           ND_TCHECK_LEN(tptr, pdu_len);
            pdu = (const rpki_rtr_pdu_ipv4_prefix *)tptr;
            ND_PRINT((ndo, "%sIPv4 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",
                   indent_string(indent+2),
@@ -278,7 +278,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
 
            if (pdu_len != sizeof(rpki_rtr_pdu) + 24)
                goto invalid;
-           ND_TCHECK2(*tptr, pdu_len);
+           ND_TCHECK_LEN(tptr, pdu_len);
            pdu = (const rpki_rtr_pdu_ipv6_prefix *)tptr;
            ND_PRINT((ndo, "%sIPv6 Prefix %s/%u-%u, origin-as %u, flags 0x%02x",
                   indent_string(indent+2),
@@ -297,7 +297,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
            /* Do not test for the "Length of Error Text" data element yet. */
            if (pdu_len < tlen + 4)
                goto invalid;
-           ND_TCHECK2(*tptr, tlen + 4);
+           ND_TCHECK_LEN(tptr, tlen + 4);
            /* Safe up to and including the "Length of Encapsulated PDU"
             * data element, more data elements may be present.
             */
@@ -327,7 +327,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
                if (pdu_len < tlen + encapsulated_pdu_length)
                    goto invalid;
                if (! recurse) {
-                   ND_TCHECK2(*tptr, tlen + encapsulated_pdu_length);
+                   ND_TCHECK_LEN(tptr, tlen + encapsulated_pdu_length);
                }
                else {
                    ND_PRINT((ndo, "%s-----encapsulated PDU-----", indent_string(indent+4)));
@@ -339,7 +339,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
 
            if (pdu_len < tlen + 4)
                goto invalid;
-           ND_TCHECK2(*tptr, tlen + 4);
+           ND_TCHECK_LEN(tptr, tlen + 4);
            /* Safe up to and including the "Length of Error Text" data element,
             * one more data element may be present.
             */
@@ -362,7 +362,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
        break;
 
     default:
-       ND_TCHECK2(*tptr, pdu_len);
+       ND_TCHECK_LEN(tptr, pdu_len);
 
        /*
         * Unknown data, please hexdump.
@@ -378,7 +378,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
 
 invalid:
     ND_PRINT((ndo, "%s", istr));
-    ND_TCHECK2(*tptr, len);
+    ND_TCHECK_LEN(tptr, len);
     return len;
 trunc:
     ND_PRINT((ndo, "\n\t%s", tstr));
index 4ebf4f72e1c3f243026d6d2ab7dd0bf2b6166aeb..dfedaf50375725935bfbfc3dfcaf2048bb147618 100644 (file)
@@ -593,7 +593,7 @@ rsvp_intserv_print(netdissect_options *ndo,
         */
 
         if (parameter_length == 20) {
-           ND_TCHECK2(*(tptr + 4), 20);
+           ND_TCHECK_LEN(tptr + 4, 20);
             bw.i = EXTRACT_BE_U_4(tptr + 4);
             ND_PRINT((ndo, "\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000));
             bw.i = EXTRACT_BE_U_4(tptr + 8);
@@ -682,7 +682,7 @@ rsvp_obj_print(netdissect_options *ndo,
 
     while(tlen>=sizeof(struct rsvp_object_header)) {
         /* did we capture enough for fully decoding the object header ? */
-        ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header));
+        ND_TCHECK_LEN(tptr, sizeof(struct rsvp_object_header));
 
         rsvp_obj_header = (const struct rsvp_object_header *)tptr;
         rsvp_obj_len=EXTRACT_BE_U_2(rsvp_obj_header->length);
@@ -726,7 +726,7 @@ rsvp_obj_print(netdissect_options *ndo,
         obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header);
 
         /* did we capture enough for fully decoding the object ? */
-        if (!ND_TTEST2(*tptr, rsvp_obj_len))
+        if (!ND_TTEST_LEN(tptr, rsvp_obj_len))
             return -1;
         hexdump=FALSE;
 
index 3f3eea1aed69c7d619000c14737a988a8654fc51..2f5ac014eab287c178a51c4f8e381633dbc35e2f 100644 (file)
@@ -534,7 +534,7 @@ rx_print(netdissect_options *ndo,
        uint8_t type, flags;
        uint32_t opcode;
 
-       if (!ND_TTEST2(*bp, sizeof (struct rx_header))) {
+       if (!ND_TTEST_LEN(bp, sizeof(struct rx_header))) {
                ND_PRINT((ndo, " [|rx] (%u)", length));
                return;
        }
@@ -753,7 +753,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
  */
 
 #define FIDOUT() { uint32_t n1, n2, n3; \
-                       ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \
+                       ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \
                        n1 = EXTRACT_BE_U_4(bp); \
                        bp += sizeof(uint32_t); \
                        n2 = EXTRACT_BE_U_4(bp); \
@@ -764,7 +764,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define STROUT(MAX) { uint32_t _i; \
-                       ND_TCHECK2(bp[0], sizeof(uint32_t)); \
+                       ND_TCHECK_LEN(bp, sizeof(uint32_t)); \
                        _i = EXTRACT_BE_U_4(bp); \
                        if (_i > (MAX)) \
                                goto trunc; \
@@ -791,7 +791,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define UINT64OUT() { uint64_t _i; \
-                       ND_TCHECK2(bp[0], sizeof(uint64_t)); \
+                       ND_TCHECK_LEN(bp, sizeof(uint64_t)); \
                        _i = EXTRACT_BE_U_8(bp); \
                        bp += sizeof(uint64_t); \
                        ND_PRINT((ndo, " %" PRIu64, _i)); \
@@ -807,7 +807,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define STOREATTROUT() { uint32_t mask, _i; \
-                       ND_TCHECK2(bp[0], (sizeof(uint32_t)*6)); \
+                       ND_TCHECK_LEN(bp, (sizeof(uint32_t) * 6)); \
                        mask = EXTRACT_BE_U_4(bp); bp += sizeof(uint32_t); \
                        if (mask) ND_PRINT((ndo, " StoreStatus")); \
                        if (mask & 1) { ND_PRINT((ndo, " date")); DATEOUT(); } \
@@ -825,7 +825,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define UBIK_VERSIONOUT() {uint32_t epoch; uint32_t counter; \
-                       ND_TCHECK2(bp[0], sizeof(uint32_t) * 2); \
+                       ND_TCHECK_LEN(bp, sizeof(uint32_t) * 2); \
                        epoch = EXTRACT_BE_U_4(bp); \
                        bp += sizeof(uint32_t); \
                        counter = EXTRACT_BE_U_4(bp); \
@@ -834,7 +834,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define AFSUUIDOUT() {uint32_t temp; int _i; \
-                       ND_TCHECK2(bp[0], 11*sizeof(uint32_t)); \
+                       ND_TCHECK_LEN(bp, 11 * sizeof(uint32_t)); \
                        temp = EXTRACT_BE_U_4(bp); \
                        bp += sizeof(uint32_t); \
                        ND_PRINT((ndo, " %08x", temp)); \
@@ -860,7 +860,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                        uint32_t k; \
                        if ((MAX) + 1 > sizeof(s)) \
                                goto trunc; \
-                       ND_TCHECK2(bp[0], (MAX) * sizeof(uint32_t)); \
+                       ND_TCHECK_LEN(bp, (MAX) * sizeof(uint32_t)); \
                        sp = s; \
                        for (k = 0; k < (MAX); k++) { \
                                *sp++ = (u_char) EXTRACT_BE_U_4(bp); \
@@ -873,7 +873,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
                }
 
 #define DESTSERVEROUT() { uint32_t n1, n2, n3; \
-                       ND_TCHECK2(bp[0], sizeof(uint32_t) * 3); \
+                       ND_TCHECK_LEN(bp, sizeof(uint32_t) * 3); \
                        n1 = EXTRACT_BE_U_4(bp); \
                        bp += sizeof(uint32_t); \
                        n2 = EXTRACT_BE_U_4(bp); \
@@ -957,7 +957,7 @@ fs_print(netdissect_options *ndo,
                        ND_TCHECK_4(bp);
                        i = EXTRACT_BE_U_4(bp);
                        bp += sizeof(uint32_t);
-                       ND_TCHECK2(bp[0], i);
+                       ND_TCHECK_LEN(bp, i);
                        i = min(AFSOPAQUEMAX, i);
                        strncpy(a, (const char *) bp, i);
                        a[i] = '\0';
@@ -1092,7 +1092,7 @@ fs_reply_print(netdissect_options *ndo,
                        ND_TCHECK_4(bp);
                        i = EXTRACT_BE_U_4(bp);
                        bp += sizeof(uint32_t);
-                       ND_TCHECK2(bp[0], i);
+                       ND_TCHECK_LEN(bp, i);
                        i = min(AFSOPAQUEMAX, i);
                        strncpy(a, (const char *) bp, i);
                        a[i] = '\0';
@@ -1773,7 +1773,7 @@ vldb_reply_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, " %u", j));
                                bp += sizeof(uint32_t);
                        }
-                       ND_TCHECK2(bp[0], 8 * sizeof(uint32_t));
+                       ND_TCHECK_LEN(bp, 8 * sizeof(uint32_t));
                        bp += 8 * sizeof(uint32_t);
                        ND_PRINT((ndo, " rwvol"));
                        UINTOUT();
@@ -1820,7 +1820,7 @@ vldb_reply_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, " %u", j));
                                bp += sizeof(uint32_t);
                        }
-                       ND_TCHECK2(bp[0], 13 * sizeof(uint32_t));
+                       ND_TCHECK_LEN(bp, 13 * sizeof(uint32_t));
                        bp += 13 * sizeof(uint32_t);
                        ND_PRINT((ndo, " rwvol"));
                        UINTOUT();
@@ -1845,11 +1845,11 @@ vldb_reply_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, " afsuuid"));
                                        AFSUUIDOUT();
                                } else {
-                                       ND_TCHECK2(bp[0], 44);
+                                       ND_TCHECK_LEN(bp, 44);
                                        bp += 44;
                                }
                        }
-                       ND_TCHECK2(bp[0], 4 * 13);
+                       ND_TCHECK_LEN(bp, 4 * 13);
                        bp += 4 * 13;
                        ND_PRINT((ndo, " partitions"));
                        for (i = 0; i < 13; i++) {
@@ -1861,7 +1861,7 @@ vldb_reply_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, " %u", j));
                                bp += sizeof(uint32_t);
                        }
-                       ND_TCHECK2(bp[0], 13 * sizeof(uint32_t));
+                       ND_TCHECK_LEN(bp, 13 * sizeof(uint32_t));
                        bp += 13 * sizeof(uint32_t);
                        ND_PRINT((ndo, " rwvol"));
                        UINTOUT();
@@ -1951,7 +1951,7 @@ kauth_print(netdissect_options *ndo,
                        ND_TCHECK_4(bp);
                        i = EXTRACT_BE_U_4(bp);
                        bp += sizeof(uint32_t);
-                       ND_TCHECK2(bp[0], i);
+                       ND_TCHECK_LEN(bp, i);
                        bp += i;
                        ND_PRINT((ndo, " principal"));
                        STROUT(KANAMEMAX);
@@ -2718,7 +2718,7 @@ rx_ack_print(netdissect_options *ndo,
 
        bp += sizeof(struct rx_header);
 
-       ND_TCHECK2(bp[0], sizeof(struct rx_ackPacket));
+       ND_TCHECK_LEN(bp, sizeof(struct rx_ackPacket));
 
        rxa = (const struct rx_ackPacket *) bp;
        bp += sizeof(struct rx_ackPacket);
@@ -2759,7 +2759,7 @@ rx_ack_print(netdissect_options *ndo,
        nAcks = EXTRACT_U_1(rxa->nAcks);
        if (nAcks != 0) {
 
-               ND_TCHECK2(bp[0], nAcks);
+               ND_TCHECK_LEN(bp, nAcks);
 
                /*
                 * Sigh, this is gross, but it seems to work to collapse
index 9f16965483f525cc579dda1c77f408a24f6565a0..66d4884913105b832d34257338c8f2fec7282890 100644 (file)
@@ -586,7 +586,7 @@ sctp_print(netdissect_options *ndo,
         break;
       }
 
-      ND_TCHECK2(*bp, chunkLength);
+      ND_TCHECK_LEN(bp, chunkLength);
 
       bp += sizeof(*chunkDescPtr);
       sctpPacketLengthRemaining -= sizeof(*chunkDescPtr);
@@ -806,7 +806,7 @@ sctp_print(netdissect_options *ndo,
         * Fail if the alignment padding isn't in the captured data.
         * Otherwise, skip it.
         */
-       ND_TCHECK2(*bp, align);
+       ND_TCHECK_LEN(bp, align);
        bp += align;
        sctpPacketLengthRemaining -= align;
       }
index 0ccb1f32337d1aee77e9267ffcc9d697f4bba3bb..b16a3ed60cd52de2a59c0466d7ba3dedd34cc1b8 100644 (file)
@@ -945,7 +945,7 @@ sflow_print(netdissect_options *ndo,
            goto trunc;
 
         /* did we capture enough for fully decoding the sample ? */
-        ND_TCHECK2(*tptr, sflow_sample_len);
+        ND_TCHECK_LEN(tptr, sflow_sample_len);
 
        switch(sflow_sample_type) {
         case SFLOW_FLOW_SAMPLE:
index dfa26e086277e21f8bfe3063f4eb0178e43e20d3..d30aa219f7455a0d5b6eb22587360cf45c97659b 100644 (file)
@@ -366,7 +366,7 @@ slow_marker_lacp_print(netdissect_options *ndo,
         if (tlen < sizeof(struct tlv_header_t))
             goto tooshort;
         /* did we capture enough for fully decoding the tlv header ? */
-        ND_TCHECK2(*tptr, sizeof(struct tlv_header_t));
+        ND_TCHECK_LEN(tptr, sizeof(struct tlv_header_t));
         tlv_header = (const struct tlv_header_t *)tptr;
         tlv_len = tlv_header->length;
 
@@ -396,7 +396,7 @@ slow_marker_lacp_print(netdissect_options *ndo,
         if (tlen < tlv_len)
             goto tooshort;
         /* did we capture enough for fully decoding the tlv ? */
-        ND_TCHECK2(*tptr, tlv_len);
+        ND_TCHECK_LEN(tptr, tlv_len);
 
         tlv_tptr=tptr+sizeof(struct tlv_header_t);
         tlv_tlen=tlv_len-sizeof(struct tlv_header_t);
@@ -564,7 +564,7 @@ slow_oam_print(netdissect_options *ndo,
 
             if (tlen < length)
                 goto tooshort;
-            ND_TCHECK2(*tptr, length);
+            ND_TCHECK_LEN(tptr, length);
 
             hexdump = FALSE;
             switch (type) {
@@ -663,7 +663,7 @@ slow_oam_print(netdissect_options *ndo,
 
             if (tlen < length)
                 goto tooshort;
-            ND_TCHECK2(*tptr, length);
+            ND_TCHECK_LEN(tptr, length);
 
             hexdump = FALSE;
             switch (type) {
index 1e098dbd0641d7222a62ab5dc1aab7414f2f623e..1fdd5bf8d8bda2e67627ae45a5dacc88b0e2fec7 100644 (file)
@@ -500,7 +500,7 @@ asn1_parse(netdissect_options *ndo,
                        ND_PRINT((ndo, "[asnlen? %d<%d]", len, noct));
                        return -1;
                }
-               ND_TCHECK2(*p, noct);
+               ND_TCHECK_LEN(p, noct);
                for (; noct-- > 0; len--, hdr++) {
                        elem->asnlen = (elem->asnlen << ASN_SHIFT8) | EXTRACT_U_1(p);
                        p++;
@@ -522,7 +522,7 @@ asn1_parse(netdissect_options *ndo,
                ND_PRINT((ndo, "[id?%c/%s/%d]", *Form[form], Class[class].name, id));
                return -1;
        }
-       ND_TCHECK2(*p, elem->asnlen);
+       ND_TCHECK_LEN(p, elem->asnlen);
 
        switch (form) {
        case PRIMITIVE:
@@ -680,7 +680,7 @@ asn1_print_octets(netdissect_options *ndo, struct be *elem)
        uint32_t asnlen = elem->asnlen;
        uint32_t i;
 
-       ND_TCHECK2(*p, asnlen);
+       ND_TCHECK_LEN(p, asnlen);
        for (i = asnlen; i-- > 0; p++)
                ND_PRINT((ndo, "_%.2x", EXTRACT_U_1(p)));
        return 0;
@@ -699,7 +699,7 @@ asn1_print_string(netdissect_options *ndo, struct be *elem)
        uint32_t i;
 
        p = elem->data.str;
-       ND_TCHECK2(*p, asnlen);
+       ND_TCHECK_LEN(p, asnlen);
        for (i = asnlen; printable && i-- > 0; p++)
                printable = ND_ISPRINT(EXTRACT_U_1(p));
        p = elem->data.str;
@@ -756,7 +756,7 @@ asn1_print(netdissect_options *ndo,
                        for (; a->node; a++) {
                                if (i < a->oid_len)
                                        continue;
-                               if (!ND_TTEST2(*p, a->oid_len))
+                               if (!ND_TTEST_LEN(p, a->oid_len))
                                        continue;
                                if (memcmp(a->oid, p, a->oid_len) == 0) {
                                        objp = a->node->child;
@@ -823,7 +823,7 @@ asn1_print(netdissect_options *ndo,
                if (asnlen != ASNLEN_INETADDR)
                        ND_PRINT((ndo, "[inetaddr len!=%d]", ASNLEN_INETADDR));
                p = (const u_char *)elem->data.raw;
-               ND_TCHECK2(*p, asnlen);
+               ND_TCHECK_LEN(p, asnlen);
                for (i = asnlen; i-- != 0; p++) {
                        ND_PRINT((ndo, (i == asnlen-1) ? "%u" : ".%u", EXTRACT_U_1(p)));
                }
index f0b24f76683e38d2193342ec469f1ccaf825cff0..1a254c3d700a7140d12c74834865cc9a1f28a22b 100644 (file)
@@ -315,7 +315,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
         len = v3len - MST_BPDU_CONFIG_INFO_LENGTH;
         offset = MST_BPDU_MSTI_OFFSET;
         while (len >= MST_BPDU_MSTI_LENGTH) {
-            ND_TCHECK2(*(ptr + offset), MST_BPDU_MSTI_LENGTH);
+            ND_TCHECK_LEN(ptr + offset, MST_BPDU_MSTI_LENGTH);
 
             msti = EXTRACT_BE_U_2(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET);
             msti = msti & 0x0FFF;
index 5af9e0a024d45dbc43584fa7b4a350bba993fd5a..91d8212e931f04414bcd9bdad61821011fc37b16 100644 (file)
@@ -445,7 +445,7 @@ tcp_print(netdissect_options *ndo,
                         datalen = 0;
 
 /* Bail if "l" bytes of data are not left or were not captured  */
-#define LENCHECK(l) { if ((l) > hlen) goto bad; ND_TCHECK2(*cp, l); }
+#define LENCHECK(l) { if ((l) > hlen) goto bad; ND_TCHECK_LEN(cp, l); }
 
 
                         ND_PRINT((ndo, "%s", tok2str(tcp_option_values, "unknown-%u", opt)));
@@ -796,7 +796,7 @@ print_tcp_rst_data(netdissect_options *ndo,
 {
         int c;
 
-        ND_PRINT((ndo, ND_TTEST2(*sp, length) ? " [RST" : " [!RST"));
+        ND_PRINT((ndo, ND_TTEST_LEN(sp, length) ? " [RST" : " [!RST"));
         if (length > MAX_RST_DATA_LEN) {
                 length = MAX_RST_DATA_LEN;     /* can use -X for longer */
                 ND_PRINT((ndo, "+"));                  /* indicate we truncate */
index 94c325667699b792f59fee37123e3cdf5ecb10f7..0bc71ea82353e593c2890b649bea53ddb581cd04 100644 (file)
@@ -104,7 +104,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length)
 
     tptr = pptr;
 
-    ND_TCHECK2(*tptr, UDLD_HEADER_LEN);
+    ND_TCHECK_LEN(tptr, UDLD_HEADER_LEN);
 
     code = UDLD_EXTRACT_OPCODE(EXTRACT_U_1(tptr));
 
@@ -147,7 +147,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length)
         len -= 4;
         tptr += 4;
 
-        ND_TCHECK2(*tptr, len);
+        ND_TCHECK_LEN(tptr, len);
 
         switch (type) {
         case UDLD_DEVICE_ID_TLV:
index 41c9197e4e716020622df60b3c3bd5ee566a1269..b4fcec9424dbbdc18dd89aaad8ef4cc81f211f8a 100644 (file)
@@ -542,7 +542,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
                        udp_sum = EXTRACT_BE_U_2(up->uh_sum);
                        if (udp_sum == 0) {
                                ND_PRINT((ndo, "[no cksum] "));
-                       } else if (ND_TTEST2(cp[0], length)) {
+                       } else if (ND_TTEST_LEN(cp, length)) {
                                sum = udp_cksum(ndo, ip, up, length + sizeof(struct udphdr));
 
                                if (sum != 0) {
@@ -555,7 +555,7 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
                }
                else if (IP_V(ip) == 6 && ip6->ip6_plen) {
                        /* for IPv6, UDP checksum is mandatory */
-                       if (ND_TTEST2(cp[0], length)) {
+                       if (ND_TTEST_LEN(cp, length)) {
                                sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));
                                udp_sum = EXTRACT_BE_U_2(up->uh_sum);
 
index e931025cb9dcb5791b9d64f7c44c515d92df1944..a9a5bf604bdbe066554d5a01409da9917fa6c796 100644 (file)
@@ -172,7 +172,7 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l
         }
 
         /* did we capture enough for fully decoding the object ? */
-        ND_TCHECK2(*tptr, vqp_obj_len);
+        ND_TCHECK_LEN(tptr, vqp_obj_len);
         if (vqp_obj_len > tlen)
             goto trunc;
 
index 20da88e6c013f6d6869c2ff223a376b347cc3e1f..d9aa4b815c03760e0ffa93f8a1c7e9fdf5409a77 100644 (file)
@@ -137,7 +137,7 @@ vrrp_print(netdissect_options *ndo,
                int i;
                char c;
 
-               if (version == 2 && ND_TTEST2(bp[0], len)) {
+               if (version == 2 && ND_TTEST_LEN(bp, len)) {
                        struct cksum_vec vec[1];
 
                        vec[0].ptr = bp;
@@ -147,7 +147,7 @@ vrrp_print(netdissect_options *ndo,
                                        EXTRACT_BE_U_2(bp + 6)));
                }
 
-               if (version == 3 && ND_TTEST2(bp[0], len)) {
+               if (version == 3 && ND_TTEST_LEN(bp, len)) {
                        uint16_t cksum = nextproto4_cksum(ndo, (const struct ip *)bp2, bp,
                                len, len, IPPROTO_VRRP);
                        if (cksum)
index 735d864a5be8840ff1d46f87c22c2e9084ad9a2c..74601bb4c8787542e21f8623cf20de8df8c5aa43 100644 (file)
@@ -128,7 +128,7 @@ vtp_print (netdissect_options *ndo,
 
     tptr = pptr;
 
-    ND_TCHECK2(*tptr, VTP_HEADER_LEN);
+    ND_TCHECK_LEN(tptr, VTP_HEADER_LEN);
 
     type = EXTRACT_U_1(tptr + 1);
     ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u",
@@ -185,13 +185,13 @@ vtp_print (netdissect_options *ndo,
               EXTRACT_BE_U_4(tptr),
               ipaddr_string(ndo, tptr+4)));
        tptr += 8;
-       ND_TCHECK2(*tptr, VTP_UPDATE_TIMESTAMP_LEN);
+       ND_TCHECK_LEN(tptr, VTP_UPDATE_TIMESTAMP_LEN);
        ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x",
               EXTRACT_BE_U_4(tptr),
               EXTRACT_BE_U_4(tptr + 4),
               EXTRACT_BE_U_4(tptr + 8)));
        tptr += VTP_UPDATE_TIMESTAMP_LEN;
-       ND_TCHECK2(*tptr, VTP_MD5_DIGEST_LEN);
+       ND_TCHECK_LEN(tptr, VTP_MD5_DIGEST_LEN);
        ND_PRINT((ndo, ", MD5 digest: %08x%08x%08x%08x",
               EXTRACT_BE_U_4(tptr),
               EXTRACT_BE_U_4(tptr + 4),
@@ -248,7 +248,7 @@ vtp_print (netdissect_options *ndo,
            if (len == 0)
                break;
 
-           ND_TCHECK2(*tptr, len);
+           ND_TCHECK_LEN(tptr, len);
 
            vtp_vlan = (const struct vtp_vlan_*)tptr;
            if (len < VTP_VLAN_INFO_FIXED_PART_LEN)
@@ -264,7 +264,7 @@ vtp_print (netdissect_options *ndo,
            tptr += VTP_VLAN_INFO_FIXED_PART_LEN;
            if (len < 4*((vtp_vlan->name_len + 3)/4))
                goto trunc;
-           ND_TCHECK2(*tptr, vtp_vlan->name_len);
+           ND_TCHECK_LEN(tptr, vtp_vlan->name_len);
            fn_printzp(ndo, tptr, vtp_vlan->name_len, NULL);
 
            /*
@@ -298,7 +298,7 @@ vtp_print (netdissect_options *ndo,
                     ND_PRINT((ndo, " (TLV goes past the end of the packet)"));
                     return;
                 }
-                ND_TCHECK2(*tptr, tlv_len * 2 +2);
+                ND_TCHECK_LEN(tptr, tlv_len * 2 + 2);
 
                 /*
                  * We assume the value is a 2-byte integer; the length is
index 2a195165e98f7661d7b31f499c4c635c7dc3079e..f3fd8556c0182cd0867dd61171e5f7cf8bb3cad1 100644 (file)
@@ -67,7 +67,7 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len)
     if (len < VXLAN_GPE_HDR_LEN)
         goto trunc;
 
-    ND_TCHECK2(*bp, VXLAN_GPE_HDR_LEN);
+    ND_TCHECK_LEN(bp, VXLAN_GPE_HDR_LEN);
 
     flags = EXTRACT_U_1(bp);
     bp += 3;
index b8914fe11424b74c9c40bbf4a74829d7ecf2dbc3..82aec20cca2669517f86628d1c22e9e221f1f724 100644 (file)
@@ -53,7 +53,7 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len)
     if (len < VXLAN_HDR_LEN)
         goto trunc;
 
-    ND_TCHECK2(*bp, VXLAN_HDR_LEN);
+    ND_TCHECK_LEN(bp, VXLAN_HDR_LEN);
 
     flags = EXTRACT_U_1(bp);
     bp += 4;
index b2cd54ca1348eeaefb485a45b558faeb02b1b00c..7be80266794ca609138d53b7a65dccf2980b3a92 100644 (file)
@@ -203,7 +203,7 @@ wb_id(netdissect_options *ndo,
        len -= sizeof(*io) * nid;
        io = (const struct id_off *)(id + 1);
        cp = (const char *)(io + nid);
-       if (ND_TTEST2(*cp, len)) {
+       if (ND_TTEST_LEN(cp, len)) {
                ND_PRINT((ndo, "\""));
                fn_print(ndo, (const u_char *)cp, (const u_char *)cp + len);
                ND_PRINT((ndo, "\""));
index b53745e51932f348663917e13e7f752ad0a8305e..e43d071780064048adb012efbe25a36179f54e97 100644 (file)
@@ -89,13 +89,13 @@ zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep)
        } else {
                header_len = 1 + 8; /* 0xFF, length */
                ND_PRINT((ndo, " frame flags+body (64-bit) length"));
-               ND_TCHECK2(*cp, header_len); /* 0xFF, length */
+               ND_TCHECK_LEN(cp, header_len); /* 0xFF, length */
                body_len_declared = EXTRACT_BE_U_8(cp + 1);
                ND_PRINT((ndo, " %" PRIu64, body_len_declared));
        }
        if (body_len_declared == 0)
                return cp + header_len; /* skip to the next frame */
-       ND_TCHECK2(*cp, header_len + 1); /* ..., flags */
+       ND_TCHECK_LEN(cp, header_len + 1); /* ..., flags */
        flags = EXTRACT_U_1(cp + header_len);
 
        body_len_captured = ep - cp - header_len;
@@ -127,12 +127,12 @@ zmtp1_print_frame(netdissect_options *ndo, const u_char *cp, const u_char *ep)
 
        /*
         * Do not advance cp by the sum of header_len and body_len_declared
-        * before each offset has successfully passed ND_TCHECK2() as the
+        * before each offset has successfully passed ND_TCHECK_LEN() as the
         * sum can roll over (9 + 0xfffffffffffffff7 = 0) and cause an
         * infinite loop.
         */
        cp += header_len;
-       ND_TCHECK2(*cp, body_len_declared); /* Next frame within the buffer ? */
+       ND_TCHECK_LEN(cp, body_len_declared); /* Next frame within the buffer ? */
        return cp + body_len_declared;
 
 trunc:
index 204e3456e2d47fa36b089f08f845ecffd8385765..51651bf35dacc10a1552520e2a49236c2ef96866 100644 (file)
@@ -130,7 +130,7 @@ signature_verify(netdissect_options *ndo, const u_char *pptr, u_int plen,
     /*
      * Do we have all the packet data to be checked?
      */
-    if (!ND_TTEST2(*pptr, plen)) {
+    if (!ND_TTEST_LEN(pptr, plen)) {
         /* No. */
         return (CANT_CHECK_SIGNATURE);
     }
@@ -138,7 +138,7 @@ signature_verify(netdissect_options *ndo, const u_char *pptr, u_int plen,
     /*
      * Do we have the entire signature to check?
      */
-    if (!ND_TTEST2(*sig_ptr, sizeof(sig))) {
+    if (!ND_TTEST_LEN(sig_ptr, sizeof(sig))) {
         /* No. */
         return (CANT_CHECK_SIGNATURE);
     }
index 5a292a3600432f144330ae87978fb484c5a285e7..253721dbe605dab49b467246ccf3ba71a0ba3fef 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -481,7 +481,7 @@ smb_fdata1(netdissect_options *ndo,
        case 'P':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(buf[0], l);
+           ND_TCHECK_LEN(buf, l);
            buf += l;
            fmt++;
            while (isdigit((unsigned char)*fmt))
@@ -653,7 +653,7 @@ smb_fdata1(netdissect_options *ndo,
        case 's':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(*buf, l);
+           ND_TCHECK_LEN(buf, l);
            ND_PRINT((ndo, "%-*.*s", l, l, buf));
            buf += l;
            fmt++;
@@ -663,7 +663,7 @@ smb_fdata1(netdissect_options *ndo,
          }
        case 'c':
          {
-           ND_TCHECK2(*buf, stringlen);
+           ND_TCHECK_LEN(buf, stringlen);
            ND_PRINT((ndo, "%-*.*s", (int)stringlen, (int)stringlen, buf));
            buf += stringlen;
            fmt++;
@@ -685,7 +685,7 @@ smb_fdata1(netdissect_options *ndo,
        case 'h':
          {
            int l = atoi(fmt + 1);
-           ND_TCHECK2(*buf, l);
+           ND_TCHECK_LEN(buf, l);
            while (l--) {
                ND_PRINT((ndo, "%02x", EXTRACT_U_1(buf)));
                buf++;