]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ENC: Use ND_TCHECK_LEN() for a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 12 Nov 2020 16:57:49 +0000 (17:57 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 12 Nov 2020 16:57:49 +0000 (17:57 +0100)
Moreover:
Define ND_LONGJMP_FROM_TCHECK.

print-enc.c

index 8406caad1718914bed7d85d081c0e30df81dda96..5a781af4fbdf62608ab2f1021b62e30f0effb7ae 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "netdissect-stdinc.h"
 
+#define ND_LONGJMP_FROM_TCHECK
 #include "netdissect.h"
 #include "extract.h"
 #include "af.h"
@@ -104,11 +105,7 @@ enc_if_print(netdissect_options *ndo,
        const struct enchdr *hdr;
 
        ndo->ndo_protocol = "enc";
-       if (caplen < ENC_HDRLEN) {
-               ndo->ndo_ll_hdr_len += caplen;
-               nd_print_trunc(ndo);
-               return;
-       }
+       ND_TCHECK_LEN(p, ENC_HDRLEN);
        ndo->ndo_ll_hdr_len += ENC_HDRLEN;
 
        hdr = (const struct enchdr *)p;