X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ea4e272785eb3a1aab6ac148f178439c86aa68ae..c39d40a767a1ae36171e5bcbf6f157ff3e80fb6c:/print-ptp.c diff --git a/print-ptp.c b/print-ptp.c index c6d8e544..f4ccbe9d 100644 --- a/print-ptp.c +++ b/print-ptp.c @@ -24,7 +24,6 @@ #include "netdissect-stdinc.h" #include "netdissect.h" #include "extract.h" -#include /* * PTP header @@ -432,14 +431,12 @@ ptp_print_2(netdissect_options *ndo, const u_char *bp, u_int length) * PTP general message */ void -ptp_print(netdissect_options *ndo, const u_char *bp, u_int len) +ptp_print(netdissect_options *ndo, const u_char *bp, u_int length) { u_int vers; ndo->ndo_protocol = "ptp"; - if (len < PTP_HDR_LEN) { - goto trunc; - } + ND_LCHECK_U(length, PTP_HDR_LEN); vers = GET_BE_U_2(bp) & PTP_VERS_MASK; ND_PRINT("PTPv%u",vers); switch(vers) { @@ -447,7 +444,7 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int len) ptp_print_1(ndo); break; case PTP_VER_2: - ptp_print_2(ndo, bp, len); + ptp_print_2(ndo, bp, length); break; default: //ND_PRINT("ERROR: unknown-version\n"); @@ -455,9 +452,8 @@ ptp_print(netdissect_options *ndo, const u_char *bp, u_int len) } return; -trunc: - nd_print_trunc(ndo); - return; +invalid: + nd_print_invalid(ndo); } static void