mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
ForCES: Remove an unnecessary ND_TCHECK_*()
Use more ND_ICHECK_U()/ND_ICHECK_ZU().
This commit is contained in:
parent
85e566a577
commit
5182a25a2a
@ -848,9 +848,7 @@ pdatacnt_print(netdissect_options *ndo,
|
|||||||
ND_PRINT("%sTABLE APPEND\n", ib);
|
ND_PRINT("%sTABLE APPEND\n", ib);
|
||||||
}
|
}
|
||||||
for (i = 0; i < IDcnt; i++) {
|
for (i = 0; i < IDcnt; i++) {
|
||||||
ND_TCHECK_4(pptr);
|
ND_ICHECK_U(len, <, 4);
|
||||||
if (len < 4)
|
|
||||||
goto invalid;
|
|
||||||
id = GET_BE_U_4(pptr);
|
id = GET_BE_U_4(pptr);
|
||||||
if (ndo->ndo_vflag >= 3)
|
if (ndo->ndo_vflag >= 3)
|
||||||
ND_PRINT("%sID#%02u: %u\n", ib, i + 1, id);
|
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);
|
chk_op_type(ndo, type, op_msk, ops->op_msk);
|
||||||
|
|
||||||
if (ops->print(ndo, (const u_char *)pdtlv,
|
ND_ICHECK_U(ops->print(ndo, (const u_char *)pdtlv,
|
||||||
tll + pad + TLV_HDRL, op_msk,
|
tll + pad + TLV_HDRL, op_msk, indent + 2),
|
||||||
indent + 2) == -1)
|
==, -1);
|
||||||
goto invalid;
|
|
||||||
len -= (TLV_HDRL + pad + tll);
|
len -= (TLV_HDRL + pad + tll);
|
||||||
} else {
|
} else {
|
||||||
ND_PRINT("Invalid path data content type 0x%x len %u\n",
|
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;
|
uint16_t idcnt = 0;
|
||||||
|
|
||||||
ND_TCHECK_SIZE(pdh);
|
ND_TCHECK_SIZE(pdh);
|
||||||
if (len < sizeof(struct pathdata_h))
|
ND_ICHECK_ZU(len, <, sizeof(struct pathdata_h));
|
||||||
goto invalid;
|
|
||||||
if (ndo->ndo_vflag >= 3) {
|
if (ndo->ndo_vflag >= 3) {
|
||||||
ND_PRINT("\n%sPathdata: Flags 0x%x ID count %u\n",
|
ND_PRINT("\n%sPathdata: Flags 0x%x ID count %u\n",
|
||||||
ib, GET_BE_U_2(pdh->pflags),
|
ib, GET_BE_U_2(pdh->pflags),
|
||||||
@ -1129,8 +1125,8 @@ recpdoptlv_print(netdissect_options *ndo,
|
|||||||
tlvl,
|
tlvl,
|
||||||
tlvl - TLV_HDRL);
|
tlvl - TLV_HDRL);
|
||||||
|
|
||||||
if (pdata_print(ndo, dp, tlvl - TLV_HDRL, op_msk, indent + 1) == -1)
|
ND_ICHECK_U(pdata_print(ndo, dp, tlvl - TLV_HDRL, op_msk, indent + 1),
|
||||||
goto invalid;
|
==, -1);
|
||||||
pdtlv = GO_NXT_TLV(pdtlv, len);
|
pdtlv = GO_NXT_TLV(pdtlv, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1610,9 +1606,7 @@ forces_type_print(netdissect_options *ndo,
|
|||||||
rc = tops->print(ndo, TLV_DATA(tltlv),
|
rc = tops->print(ndo, TLV_DATA(tltlv),
|
||||||
tlvl,
|
tlvl,
|
||||||
tops->op_msk, 9);
|
tops->op_msk, 9);
|
||||||
if (rc < 0) {
|
ND_ICHECK_U(rc, <, 0);
|
||||||
goto invalid;
|
|
||||||
}
|
|
||||||
tltlv = GO_NXT_TLV(tltlv, rlen);
|
tltlv = GO_NXT_TLV(tltlv, rlen);
|
||||||
ttlv--;
|
ttlv--;
|
||||||
if (ttlv <= 0)
|
if (ttlv <= 0)
|
||||||
@ -1693,9 +1687,7 @@ forces_print(netdissect_options *ndo,
|
|||||||
ForCES_RS1(fhdr), ForCES_RS2(fhdr));
|
ForCES_RS1(fhdr), ForCES_RS2(fhdr));
|
||||||
}
|
}
|
||||||
rc = forces_type_print(ndo, pptr, fhdr, mlen, tops);
|
rc = forces_type_print(ndo, pptr, fhdr, mlen, tops);
|
||||||
if (rc < 0) {
|
ND_ICHECK_U(rc, <, 0);
|
||||||
goto invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ndo->ndo_vflag >= 4) {
|
if (ndo->ndo_vflag >= 4) {
|
||||||
ND_PRINT("\n\t Raw ForCES message\n\t [");
|
ND_PRINT("\n\t Raw ForCES message\n\t [");
|
||||||
|
Loading…
Reference in New Issue
Block a user