X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/d9740d6f4c1b81bd431c1d195ae9d4623fe535ef..cfa9ab5f80dd9a1024e1a765bc0d24c57652b6bc:/print-udp.c?ds=inline diff --git a/print-udp.c b/print-udp.c index b315f1e7..fc0710d6 100644 --- a/print-udp.c +++ b/print-udp.c @@ -369,10 +369,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, if (ndo->ndo_packettype != PT_RPC) udpipaddr_print(ndo, ip, sport, dport); - if (length < sizeof(struct udphdr)) { - ND_PRINT("undersized-udp %u", length); - goto invalid; - } + ND_LCHECKMSG_ZU(length, sizeof(struct udphdr), "undersized-udp"); ulen = GET_BE_U_2(up->uh_ulen); udp_sum = GET_BE_U_2(up->uh_sum); /* @@ -382,10 +379,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, */ if (ulen == 0 && length > 65535) ulen = length; - if (ulen < sizeof(struct udphdr)) { - ND_PRINT("undersized-udplength %u", ulen); - goto invalid; - } + ND_LCHECKMSG_ZU(ulen, sizeof(struct udphdr), "undersized-udplength"); ulen -= sizeof(struct udphdr); length -= sizeof(struct udphdr); if (ulen < length)