summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netdissect.h7
-rw-r--r--print-802_11.c38
-rw-r--r--print-ah.c2
-rw-r--r--print-ahcp.c26
-rw-r--r--print-aoe.c16
-rw-r--r--print-arp.c4
-rw-r--r--print-atalk.c8
-rw-r--r--print-babel.c2
-rw-r--r--print-beep.c2
-rw-r--r--print-bfd.c4
-rw-r--r--print-bgp.c118
-rw-r--r--print-bootp.c6
-rw-r--r--print-carp.c2
-rw-r--r--print-cdp.c12
-rw-r--r--print-cfm.c4
-rw-r--r--print-chdlc.c4
-rw-r--r--print-dccp.c6
-rw-r--r--print-decnet.c8
-rw-r--r--print-dhcp6.c2
-rw-r--r--print-domain.c12
-rw-r--r--print-dtp.c4
-rw-r--r--print-dvmrp.c2
-rw-r--r--print-eap.c2
-rw-r--r--print-egp.c2
-rw-r--r--print-eigrp.c4
-rw-r--r--print-fr.c6
-rw-r--r--print-geneve.c2
-rw-r--r--print-geonet.c4
-rw-r--r--print-hncp.c2
-rw-r--r--print-icmp.c2
-rw-r--r--print-icmp6.c27
-rw-r--r--print-igmp.c2
-rw-r--r--print-igrp.c6
-rw-r--r--print-ip.c6
-rw-r--r--print-ip6opts.c4
-rw-r--r--print-ipx.c8
-rw-r--r--print-isakmp.c22
-rw-r--r--print-isoclns.c81
-rw-r--r--print-juniper.c4
-rw-r--r--print-krb.c4
-rw-r--r--print-l2tp.c2
-rw-r--r--print-ldp.c10
-rw-r--r--print-lisp.c10
-rw-r--r--print-llc.c6
-rw-r--r--print-lldp.c8
-rw-r--r--print-lmp.c4
-rw-r--r--print-loopback.c12
-rw-r--r--print-lspping.c30
-rw-r--r--print-lwapp.c4
-rw-r--r--print-lwres.c2
-rw-r--r--print-m3ua.c14
-rw-r--r--print-mpcp.c20
-rw-r--r--print-mpls.c2
-rw-r--r--print-nfs.c12
-rw-r--r--print-nsh.c4
-rw-r--r--print-ntp.c4
-rw-r--r--print-olsr.c25
-rw-r--r--print-openflow-1.0.c80
-rw-r--r--print-openflow.c4
-rw-r--r--print-ospf.c8
-rw-r--r--print-ospf6.c6
-rw-r--r--print-pgm.c38
-rw-r--r--print-pim.c24
-rw-r--r--print-ppp.c4
-rw-r--r--print-pppoe.c4
-rw-r--r--print-radius.c8
-rw-r--r--print-resp.c2
-rw-r--r--print-rpki-rtr.c18
-rw-r--r--print-rsvp.c6
-rw-r--r--print-rx.c38
-rw-r--r--print-sctp.c4
-rw-r--r--print-sflow.c2
-rw-r--r--print-slow.c8
-rw-r--r--print-snmp.c12
-rw-r--r--print-stp.c2
-rw-r--r--print-tcp.c4
-rw-r--r--print-udld.c4
-rw-r--r--print-udp.c4
-rw-r--r--print-vqp.c2
-rw-r--r--print-vrrp.c4
-rw-r--r--print-vtp.c12
-rw-r--r--print-vxlan-gpe.c2
-rw-r--r--print-vxlan.c2
-rw-r--r--print-wb.c2
-rw-r--r--print-zeromq.c8
-rw-r--r--signature.c4
-rw-r--r--smbutil.c8
87 files changed, 492 insertions, 478 deletions
diff --git a/netdissect.h b/netdissect.h
index 4c98164a..e3066843 100644
--- a/netdissect.h
+++ b/netdissect.h
@@ -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))
diff --git a/print-802_11.c b/print-802_11.c
index 17e128d9..2d8b16e9 100644
--- a/print-802_11.c
+++ b/print-802_11.c
@@ -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 ",
diff --git a/print-ah.c b/print-ah.c
index 6f1a357c..307fe0d3 100644
--- a/print-ah.c
+++ b/print-ah.c
@@ -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;
}
diff --git a/print-ahcp.c b/print-ahcp.c
index efe684a0..8d784c14 100644
--- a/print-ahcp.c
+++ b/print-ahcp.c
@@ -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));
diff --git a/print-aoe.c b/print-aoe.c
index e5fe7319..01f485dd 100644
--- a/print-aoe.c
+++ b/print-aoe.c
@@ -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));
diff --git a/print-arp.c b/print-arp.c
index dc8bf23f..37320a84 100644
--- a/print-arp.c
+++ b/print-arp.c
@@ -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;
diff --git a/print-atalk.c b/print-atalk.c
index ce61a44c..f8f95de4 100644
--- a/print-atalk.c
+++ b/print-atalk.c
@@ -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;
}
diff --git a/print-babel.c b/print-babel.c
index 5d4c8cb5..3f0166d1 100644
--- a/print-babel.c
+++ b/print-babel.c
@@ -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) {
diff --git a/print-beep.c b/print-beep.c
index 64a162d7..2be7a7b6 100644
--- a/print-beep.c
+++ b/print-beep.c
@@ -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
diff --git a/print-bfd.c b/print-bfd.c
index c408ac31..45ec2c5c 100644
--- a/print-bfd.c
+++ b/print-bfd.c
@@ -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)));
diff --git a/print-bgp.c b/print-bgp.c
index 0ff3da05..1f446f21 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -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;
diff --git a/print-bootp.c b/print-bootp.c
index 737c5afc..8e225f85 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -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;
}
diff --git a/print-carp.c b/print-carp.c
index b439a2d7..58981554 100644
--- a/print-carp.c
+++ b/print-carp.c
@@ -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)));
}
diff --git a/print-cdp.c b/print-cdp.c
index 364af045..bf826265 100644
--- a/print-cdp.c
+++ b/print-cdp.c
@@ -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) {
diff --git a/print-cfm.c b/print-cfm.c
index 674a3117..94624564 100644
--- a/print-cfm.c
+++ b/print-cfm.c
@@ -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) {
diff --git a/print-chdlc.c b/print-chdlc.c
index d65e7437..1c6fe36b 100644
--- a/print-chdlc.c
+++ b/print-chdlc.c
@@ -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"));
diff --git a/print-dccp.c b/print-dccp.c
index b4d1e8e5..66d215fe 100644
--- a/print-dccp.c
+++ b/print-dccp.c
@@ -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)));
diff --git a/print-decnet.c b/print-decnet.c
index 9eeff5f8..51070119 100644
--- a/print-decnet.c
+++ b/print-decnet.c
@@ -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 */
diff --git a/print-dhcp6.c b/print-dhcp6.c
index 16207fdf..5558660a 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -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:
diff --git a/print-domain.c b/print-domain.c
index c0c05d67..5281df13 100644
--- a/print-domain.c
+++ b/print-domain.c
@@ -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);
diff --git a/print-dtp.c b/print-dtp.c
index 4799f260..bf1242e0 100644
--- a/print-dtp.c
+++ b/print-dtp.c
@@ -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:
diff --git a/print-dvmrp.c b/print-dvmrp.c
index 5f56043b..cfc3f710 100644
--- a/print-dvmrp.c
+++ b/print-dvmrp.c
@@ -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 "));
diff --git a/print-eap.c b/print-eap.c
index 30c48616..95eaa17a 100644
--- a/print-eap.c
+++ b/print-eap.c
@@ -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);
diff --git a/print-egp.c b/print-egp.c
index f4bd860e..7bcf16cf 100644
--- a/print-egp.c
+++ b/print-egp.c
@@ -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:
diff --git a/print-eigrp.c b/print-eigrp.c
index c4aea016..2a139151 100644
--- a/print-eigrp.c
+++ b/print-eigrp.c
@@ -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) {
diff --git a/print-fr.c b/print-fr.c
index cd68ae81..c5d5e5d7 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -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));
}
diff --git a/print-geneve.c b/print-geneve.c
index 280be187..724e9f02 100644
--- a/print-geneve.c
+++ b/print-geneve.c
@@ -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 ["));
diff --git a/print-geonet.c b/print-geonet.c
index e96b0c49..488969ef 100644
--- a/print-geonet.c
+++ b/print-geonet.c
@@ -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) {
diff --git a/print-hncp.c b/print-hncp.c
index 09acbcf4..00ab04d1 100644
--- a/print-hncp.c
+++ b/print-hncp.c
@@ -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;
diff --git a/print-icmp.c b/print-icmp.c
index 6e517d8d..ff65a854 100644
--- a/print-icmp.c
+++ b/print-icmp.c
@@ -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;
diff --git a/print-icmp6.c b/print-icmp6.c
index 1e1454a8..594c9153 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -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," (")); /*)*/
diff --git a/print-igmp.c b/print-igmp.c
index 082919e1..d0dfd329 100644
--- a/print-igmp.c
+++ b/print-igmp.c
@@ -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;
diff --git a/print-igrp.c b/print-igrp.c
index 6cd4f69e..10915f88 100644
--- a/print-igrp.c
+++ b/print-igrp.c
@@ -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 {
diff --git a/print-ip.c b/print-ip.c
index b1deb78a..f2d1edba 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -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:
diff --git a/print-ip6opts.c b/print-ip6opts.c
index 5cf8ba4a..41b292e7 100644
--- a/print-ip6opts.c
+++ b/print-ip6opts.c
@@ -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),
diff --git a/print-ipx.c b/print-ipx.c
index dbfd7b19..ac080121 100644
--- a/print-ipx.c
+++ b/print-ipx.c
@@ -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)));
diff --git a/print-isakmp.c b/print-isakmp.c
index d82c4f28..a2683ac6 100644
--- a/print-isakmp.c
+++ b/print-isakmp.c
@@ -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"));
diff --git a/print-isoclns.c b/print-isoclns.c
index 53ad5697..131fe7f4 100644
--- a/print-isoclns.c
+++ b/print-isoclns.c
@@ -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
diff --git a/print-juniper.c b/print-juniper.c
index b8b3ec04..55564579 100644
--- a/print-juniper.c
+++ b/print-juniper.c
@@ -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++) {
diff --git a/print-krb.c b/print-krb.c
index 24839bd4..de025f93 100644
--- a/print-krb.c
+++ b/print-krb.c
@@ -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;
diff --git a/print-l2tp.c b/print-l2tp.c
index 6cf0c0ad..eb92833b 100644
--- a/print-l2tp.c
+++ b/print-l2tp.c
@@ -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
diff --git a/print-ldp.c b/print-ldp.c
index 4e71ade4..e107c52b 100644
--- a/print-ldp.c
+++ b/print-ldp.c
@@ -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) {
diff --git a/print-lisp.c b/print-lisp.c
index c8486566..804f898e 100644
--- a/print-lisp.c
+++ b/print-lisp.c
@@ -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,
diff --git a/print-llc.c b/print-llc.c
index 8212a7c2..f009f1ae 100644
--- a/print-llc.c
+++ b/print-llc.c
@@ -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;
diff --git a/print-lldp.c b/print-lldp.c
index 49eb9e9d..90dba8ee 100644
--- a/print-lldp.c
+++ b/print-lldp.c
@@ -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;
}
diff --git a/print-lmp.c b/print-lmp.c
index 97db2f47..295c0242 100644
--- a/print-lmp.c
+++ b/print-lmp.c
@@ -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) {
diff --git a/print-loopback.c b/print-loopback.c
index 9ef77a97..b7402025 100644
--- a/print-loopback.c
+++ b/print-loopback.c
@@ -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));
diff --git a/print-lspping.c b/print-lspping.c
index 89edc1dd..f32bbde7 100644
--- a/print-lspping.c
+++ b/print-lspping.c
@@ -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),
diff --git a/print-lwapp.c b/print-lwapp.c
index a33c6d3c..76ce9f9f 100644
--- a/print-lwapp.c
+++ b/print-lwapp.c
@@ -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) {
diff --git a/print-lwres.c b/print-lwres.c
index ccd0302a..51f3a7a6 100644
--- a/print-lwres.c
+++ b/print-lwres.c
@@ -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 */
diff --git a/print-m3ua.c b/print-m3ua.c
index 163b6450..c50ed0d4 100644
--- a/print-m3ua.c
+++ b/print-m3ua.c
@@ -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));
diff --git a/print-mpcp.c b/print-mpcp.c
index 1011917f..1f6446e3 100644
--- a/print-mpcp.c
+++ b/print-mpcp.c
@@ -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",
diff --git a/print-mpls.c b/print-mpls.c
index b156ef7f..c566ea14 100644
--- a/print-mpls.c
+++ b/print-mpls.c
@@ -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;
diff --git a/print-nfs.c b/print-nfs.c
index a4823842..797f53ad 100644
--- a/print-nfs.c
+++ b/print-nfs.c
@@ -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 {
diff --git a/print-nsh.c b/print-nsh.c
index b0644823..2734382c 100644
--- a/print-nsh.c
+++ b/print-nsh.c
@@ -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.
diff --git a/print-ntp.c b/print-ntp.c
index f2fbd1aa..9e571eb5 100644
--- a/print-ntp.c
+++ b/print-ntp.c
@@ -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:
diff --git a/print-olsr.c b/print-olsr.c
index fdfe706b..d307184d 100644
--- a/print-olsr.c
+++ b/print-olsr.c
@@ -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 \"",
diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c
index adab701f..ec9b6a18 100644
--- a/print-openflow-1.0.c
+++ b/print-openflow-1.0.c
@@ -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));
diff --git a/print-openflow.c b/print-openflow.c
index 687b16d6..3ef91432 100644
--- a/print-openflow.c
+++ b/print-openflow.c
@@ -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));
diff --git a/print-ospf.c b/print-ospf.c
index ea6abaab..4453a47e 100644
--- a/print-ospf.c
+++ b/print-ospf.c
@@ -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)),
diff --git a/print-ospf6.c b/print-ospf6.c
index b08aa50e..68c6ee03 100644
--- a/print-ospf6.c
+++ b/print-ospf6.c
@@ -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;
diff --git a/print-pgm.c b/print-pgm.c
index e5701ff0..16735f5d 100644
--- a/print-pgm.c
+++ b/print-pgm.c
@@ -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);
diff --git a/print-pim.c b/print-pim.c
index 26e3356b..c479c7b0 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -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,
diff --git a/print-ppp.c b/print-ppp.c
index bb8d660c..a79906f8 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -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),
diff --git a/print-pppoe.c b/print-pppoe.c
index 18baba9c..b2efcc32 100644
--- a/print-pppoe.c
+++ b/print-pppoe.c
@@ -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);
diff --git a/print-radius.c b/print-radius.c
index fda7710c..904f6594 100644
--- a/print-radius.c
+++ b/print-radius.c
@@ -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);
diff --git a/print-resp.c b/print-resp.c
index 64484601..736b933e 100644
--- a/print-resp.c
+++ b/print-resp.c
@@ -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;
diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c
index 4e2e7c14..47a13114 100644
--- a/print-rpki-rtr.c
+++ b/print-rpki-rtr.c
@@ -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));
diff --git a/print-rsvp.c b/print-rsvp.c
index 4ebf4f72..dfedaf50 100644
--- a/print-rsvp.c
+++ b/print-rsvp.c
@@ -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;
diff --git a/print-rx.c b/print-rx.c
index 3f3eea1a..2f5ac014 100644
--- a/print-rx.c
+++ b/print-rx.c
@@ -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
diff --git a/print-sctp.c b/print-sctp.c
index 9f169654..66d48849 100644
--- a/print-sctp.c
+++ b/print-sctp.c
@@ -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;
}
diff --git a/print-sflow.c b/print-sflow.c
index 0ccb1f32..b16a3ed6 100644
--- a/print-sflow.c
+++ b/print-sflow.c
@@ -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:
diff --git a/print-slow.c b/print-slow.c
index dfa26e08..d30aa219 100644
--- a/print-slow.c
+++ b/print-slow.c
@@ -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) {
diff --git a/print-snmp.c b/print-snmp.c
index 1e098dbd..1fdd5bf8 100644
--- a/print-snmp.c
+++ b/print-snmp.c
@@ -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)));
}
diff --git a/print-stp.c b/print-stp.c
index f0b24f76..1a254c3d 100644
--- a/print-stp.c
+++ b/print-stp.c
@@ -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;
diff --git a/print-tcp.c b/print-tcp.c
index 5af9e0a0..91d8212e 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -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 */
diff --git a/print-udld.c b/print-udld.c
index 94c32566..0bc71ea8 100644
--- a/print-udld.c
+++ b/print-udld.c
@@ -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:
diff --git a/print-udp.c b/print-udp.c
index 41c9197e..b4fcec94 100644
--- a/print-udp.c
+++ b/print-udp.c
@@ -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);
diff --git a/print-vqp.c b/print-vqp.c
index e931025c..a9a5bf60 100644
--- a/print-vqp.c
+++ b/print-vqp.c
@@ -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;
diff --git a/print-vrrp.c b/print-vrrp.c
index 20da88e6..d9aa4b81 100644
--- a/print-vrrp.c
+++ b/print-vrrp.c
@@ -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)
diff --git a/print-vtp.c b/print-vtp.c
index 735d864a..74601bb4 100644
--- a/print-vtp.c
+++ b/print-vtp.c
@@ -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
diff --git a/print-vxlan-gpe.c b/print-vxlan-gpe.c
index 2a195165..f3fd8556 100644
--- a/print-vxlan-gpe.c
+++ b/print-vxlan-gpe.c
@@ -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;
diff --git a/print-vxlan.c b/print-vxlan.c
index b8914fe1..82aec20c 100644
--- a/print-vxlan.c
+++ b/print-vxlan.c
@@ -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;
diff --git a/print-wb.c b/print-wb.c
index b2cd54ca..7be80266 100644
--- a/print-wb.c
+++ b/print-wb.c
@@ -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, "\""));
diff --git a/print-zeromq.c b/print-zeromq.c
index b53745e5..e43d0717 100644
--- a/print-zeromq.c
+++ b/print-zeromq.c
@@ -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:
diff --git a/signature.c b/signature.c
index 204e3456..51651bf3 100644
--- a/signature.c
+++ b/signature.c
@@ -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);
}
diff --git a/smbutil.c b/smbutil.c
index 5a292a36..253721db 100644
--- 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++;