summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-07-12 16:15:15 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2022-07-12 16:20:19 +0200
commit5182a25a2a5a3201345f52efc5600125ad1af813 (patch)
tree9e4c4c2c09a597d10fa21521a761d623e272cb73
parent85e566a57710dd1ea1c4a168f0c0d777cc4a01cb (diff)
downloadtcpdump-5182a25a2a5a3201345f52efc5600125ad1af813.tar.gz
ForCES: Remove an unnecessary ND_TCHECK_*()
Use more ND_ICHECK_U()/ND_ICHECK_ZU().
-rw-r--r--print-forces.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/print-forces.c b/print-forces.c
index 11c17555..03ea6074 100644
--- a/print-forces.c
+++ b/print-forces.c
@@ -848,9 +848,7 @@ pdatacnt_print(netdissect_options *ndo,
ND_PRINT("%sTABLE APPEND\n", ib);
}
for (i = 0; i < IDcnt; i++) {
- ND_TCHECK_4(pptr);
- if (len < 4)
- goto invalid;
+ ND_ICHECK_U(len, <, 4);
id = GET_BE_U_4(pptr);
if (ndo->ndo_vflag >= 3)
ND_PRINT("%sID#%02u: %u\n", ib, i + 1, id);
@@ -964,10 +962,9 @@ pdatacnt_print(netdissect_options *ndo,
chk_op_type(ndo, type, op_msk, ops->op_msk);
- if (ops->print(ndo, (const u_char *)pdtlv,
- tll + pad + TLV_HDRL, op_msk,
- indent + 2) == -1)
- goto invalid;
+ ND_ICHECK_U(ops->print(ndo, (const u_char *)pdtlv,
+ tll + pad + TLV_HDRL, op_msk, indent + 2),
+ ==, -1);
len -= (TLV_HDRL + pad + tll);
} else {
ND_PRINT("Invalid path data content type 0x%x len %u\n",
@@ -1000,8 +997,7 @@ pdata_print(netdissect_options *ndo,
uint16_t idcnt = 0;
ND_TCHECK_SIZE(pdh);
- if (len < sizeof(struct pathdata_h))
- goto invalid;
+ ND_ICHECK_ZU(len, <, sizeof(struct pathdata_h));
if (ndo->ndo_vflag >= 3) {
ND_PRINT("\n%sPathdata: Flags 0x%x ID count %u\n",
ib, GET_BE_U_2(pdh->pflags),
@@ -1129,8 +1125,8 @@ recpdoptlv_print(netdissect_options *ndo,
tlvl,
tlvl - TLV_HDRL);
- if (pdata_print(ndo, dp, tlvl - TLV_HDRL, op_msk, indent + 1) == -1)
- goto invalid;
+ ND_ICHECK_U(pdata_print(ndo, dp, tlvl - TLV_HDRL, op_msk, indent + 1),
+ ==, -1);
pdtlv = GO_NXT_TLV(pdtlv, len);
}
@@ -1610,9 +1606,7 @@ forces_type_print(netdissect_options *ndo,
rc = tops->print(ndo, TLV_DATA(tltlv),
tlvl,
tops->op_msk, 9);
- if (rc < 0) {
- goto invalid;
- }
+ ND_ICHECK_U(rc, <, 0);
tltlv = GO_NXT_TLV(tltlv, rlen);
ttlv--;
if (ttlv <= 0)
@@ -1693,9 +1687,7 @@ forces_print(netdissect_options *ndo,
ForCES_RS1(fhdr), ForCES_RS2(fhdr));
}
rc = forces_type_print(ndo, pptr, fhdr, mlen, tops);
- if (rc < 0) {
- goto invalid;
- }
+ ND_ICHECK_U(rc, <, 0);
if (ndo->ndo_vflag >= 4) {
ND_PRINT("\n\t Raw ForCES message\n\t [");