]> The Tcpdump Group git mirrors - tcpdump/commitdiff
NULL/LOOP: Use ND_TCHECK_LEN() for a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 17 Oct 2020 11:49:50 +0000 (13:49 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 17 Oct 2020 11:50:20 +0000 (13:50 +0200)
Moreover:
Define ND_LONGJMP_FROM_TCHECK.

print-null.c

index dea50ac2758a8065843519e7fbe27a9182568602..9f84ca391a3b8059221dc19af8e1d255e38132c3 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <string.h>
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 #include "af.h"
@@ -82,11 +83,7 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char
        uint32_t family;
 
        ndo->ndo_protocol = "null";
-       if (caplen < NULL_HDRLEN) {
-               ndo->ndo_ll_hdr_len += caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
+       ND_TCHECK_LEN(p, NULL_HDRLEN);
        ndo->ndo_ll_hdr_len += NULL_HDRLEN;
 
        family = GET_HE_U_4(p);