diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-11-19 16:02:40 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-11-19 16:02:40 +0100 |
commit | 01017da63c1c0d4b241ea29a43e5d5bd1a3a53dd (patch) | |
tree | 18699bc4506ab5e54dfa79f38d5704521328b175 /print-ether.c | |
parent | 9edeb142527f29a6e31425b4280c9be0a7962c47 (diff) | |
download | tcpdump-01017da63c1c0d4b241ea29a43e5d5bd1a3a53dd.tar.gz |
Revert "Ethernet: Remove two useless tests"
This reverts commit b7fff7058282c332ba1d8d236c9864ab21b16adf (partially)
The sanity check in print.c/pretty_print_packet() function, packet length
(length) >= capture length (caplen), apply when the ether_print()
function is called by ether_if_print(), netanalyzer_if_print() or
netanalyzer_transparent_if_print().
But the ether_print() function is called in some other cases, thus not
sure length always >= caplen.
Diffstat (limited to 'print-ether.c')
-rw-r--r-- | print-ether.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/print-ether.c b/print-ether.c index 887a8eee..d6dd9572 100644 --- a/print-ether.c +++ b/print-ether.c @@ -163,6 +163,10 @@ ether_print(netdissect_options *ndo, nd_print_trunc(ndo); return (caplen); } + if (length < ETHER_HDRLEN) { + nd_print_trunc(ndo); + return (length); + } if (ndo->ndo_eflag) { if (print_encap_header != NULL) @@ -210,6 +214,11 @@ recurse: nd_print_trunc(ndo); return (hdrlen + caplen); } + if (length < 4) { + ndo->ndo_protocol = "vlan"; + nd_print_trunc(ndo); + return (hdrlen + length); + } if (ndo->ndo_eflag) { uint16_t tag = EXTRACT_BE_U_2(p); |