aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-11-12 20:28:05 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-11-12 20:28:05 +0100
commit8b2d482d8969f2333bdae4d1b292e5de19c5e2b0 (patch)
treebc66189a867cce09159120a92597176ccb48f3cc
parent39fb6815e50e345a7b4138430d64528d39c72546 (diff)
downloadtcpdump-8b2d482d8969f2333bdae4d1b292e5de19c5e2b0.tar.gz
IPNET: Use ND_TCHECK_LEN() for a bounds check
Moreover: Define ND_LONGJMP_FROM_TCHECK. Remove a redundant ND_TCHECK_SIZE call. Remove a trunc label.
-rw-r--r--print-ipnet.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/print-ipnet.c b/print-ipnet.c
index 0f745d70..eddcc1d7 100644
--- a/print-ipnet.c
+++ b/print-ipnet.c
@@ -6,6 +6,7 @@
#include "netdissect-stdinc.h"
+#define ND_LONGJMP_FROM_TCHECK
#include "netdissect.h"
#include "extract.h"
@@ -38,7 +39,6 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
const ipnet_hdr_t *hdr;
hdr = (const ipnet_hdr_t *)bp;
- ND_TCHECK_SIZE(hdr);
ND_PRINT("%u > %u", GET_BE_U_4(hdr->iph_zsrc),
GET_BE_U_4(hdr->iph_zdst));
@@ -55,9 +55,6 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
}
ND_PRINT(", length %u: ", length);
- return;
-trunc:
- nd_print_trunc(ndo);
}
static void
@@ -65,11 +62,7 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen
{
const ipnet_hdr_t *hdr;
- if (caplen < sizeof(ipnet_hdr_t)) {
- ndo->ndo_ll_hdr_len += caplen;
- nd_print_trunc(ndo);
- return;
- }
+ ND_TCHECK_LEN(p, sizeof(ipnet_hdr_t));
ndo->ndo_ll_hdr_len += sizeof(ipnet_hdr_t);
if (ndo->ndo_eflag)