X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/49b23c5a9b0198bb382dcf43c458d46fcf2fa809..9f957a5883cb4c5c99cefa71b42fc9d2d27d73e1:/print-dtp.c diff --git a/print-dtp.c b/print-dtp.c index 1d8c66a0..bf1242e0 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -54,10 +54,10 @@ 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", - (*tptr), + EXTRACT_U_1(tptr), length)); /* @@ -71,9 +71,9 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) while (tptr < (pptr+length)) { - ND_TCHECK2(*tptr, 4); - type = EXTRACT_16BITS(tptr); - len = EXTRACT_16BITS(tptr+2); + ND_TCHECK_4(tptr); + type = EXTRACT_BE_U_2(tptr); + len = EXTRACT_BE_U_2(tptr + 2); /* XXX: should not be but sometimes it is, see the test captures */ if (type == 0) return; @@ -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: @@ -96,7 +96,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) case DTP_DTP_TYPE_TLV: if (len < 5) goto invalid; - ND_PRINT((ndo, ", 0x%x", *(tptr+4))); + ND_PRINT((ndo, ", 0x%x", EXTRACT_U_1(tptr + 4))); break; case DTP_NEIGHBOR_TLV: