X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/bbedebc666a341d8e14922dce37a92766400c798..ff23dba40e728115b878b009ec299b47b924991d:/print-cdp.c diff --git a/print-cdp.c b/print-cdp.c index 353ce4c1..116f0fa5 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -96,24 +96,20 @@ cdp_print(netdissect_options *ndo, tptr = pptr; /* temporary pointer */ - if (!ND_TTEST2(*tptr, CDP_HEADER_LEN)) - goto trunc; + ND_TCHECK2(*tptr, CDP_HEADER_LEN); ND_PRINT((ndo, "CDPv%u, ttl: %us", *tptr, *(tptr + 1))); if (ndo->ndo_vflag) ND_PRINT((ndo, ", checksum: %u (unverified), length %u", EXTRACT_16BITS(tptr), length)); tptr += CDP_HEADER_LEN; while (tptr < (pptr+length)) { - - if (!ND_TTEST2(*tptr, 4)) /* read out Type and Length */ - goto trunc; + ND_TCHECK2(*tptr, 4); /* read out Type and Length */ type = EXTRACT_16BITS(tptr); len = EXTRACT_16BITS(tptr+2); /* object length includes the 4 bytes header length */ tptr += 4; len -= 4; - if (!ND_TTEST2(*tptr, len)) - goto trunc; + ND_TCHECK2(*tptr, len); if (ndo->ndo_vflag || type == 1) { /* in non-verbose mode just print Device-ID */ @@ -130,7 +126,7 @@ cdp_print(netdissect_options *ndo, if (!ndo->ndo_vflag) ND_PRINT((ndo, ", Device-ID ")); ND_PRINT((ndo, "'")); - fn_printn(tptr, len, NULL); + fn_printn(ndo, tptr, len, NULL); ND_PRINT((ndo, "'")); break; case 0x02: /* Address */ @@ -139,7 +135,7 @@ cdp_print(netdissect_options *ndo, break; case 0x03: /* Port-ID */ ND_PRINT((ndo, "'")); - fn_printn(tptr, len, NULL); + fn_printn(ndo, tptr, len, NULL); ND_PRINT((ndo, "'")); break; case 0x04: /* Capabilities */ @@ -158,7 +154,7 @@ cdp_print(netdissect_options *ndo, break; case 0x06: /* Platform */ ND_PRINT((ndo, "'")); - fn_printn(tptr, len, NULL); + fn_printn(ndo, tptr, len, NULL); ND_PRINT((ndo, "'")); break; case 0x07: /* Prefixes */ @@ -169,7 +165,7 @@ cdp_print(netdissect_options *ndo, break; case 0x09: /* VTP Mgmt Domain - not documented */ ND_PRINT((ndo, "'")); - fn_printn(tptr, len, NULL); + fn_printn(ndo, tptr, len, NULL); ND_PRINT((ndo, "'")); break; case 0x0a: /* Native VLAN ID - not documented */ @@ -199,7 +195,7 @@ cdp_print(netdissect_options *ndo, break; case 0x14: /* System Name - not documented */ ND_PRINT((ndo, "'")); - fn_printn(tptr, len, NULL); + fn_printn(ndo, tptr, len, NULL); ND_PRINT((ndo, "'")); break; case 0x16: /* System Object ID - not documented */ @@ -210,7 +206,7 @@ cdp_print(netdissect_options *ndo, ND_PRINT((ndo, "0x%02x", *(tptr))); if (len > 1) { ND_PRINT((ndo, "/")); - fn_printn(tptr + 1, len - 1, NULL); + fn_printn(ndo, tptr + 1, len - 1, NULL); } break; default: