X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/692e9d44a502c80cc45bb41b568e385ce4f9ee38..refs/pull/1034/head:/print-vsock.c?ds=sidebyside diff --git a/print-vsock.c b/print-vsock.c index bb18c92b..1fd09fce 100644 --- a/print-vsock.c +++ b/print-vsock.c @@ -30,6 +30,7 @@ #include "netdissect-stdinc.h" #include +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" @@ -248,15 +249,9 @@ void vsock_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *cp) { - u_int caplen = h->caplen; - ndo->ndo_protocol = "vsock"; - if (caplen < sizeof(struct af_vsockmon_hdr)) { - nd_print_trunc(ndo); - ndo->ndo_ll_hdr_len += caplen; - return; - } + ND_TCHECK_LEN(cp, sizeof(struct af_vsockmon_hdr)); ndo->ndo_ll_hdr_len += sizeof(struct af_vsockmon_hdr); - vsock_hdr_print(ndo, cp, caplen); + vsock_hdr_print(ndo, cp, h->caplen); }