summaryrefslogtreecommitdiff
path: root/print.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-01-25 14:17:57 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2018-01-25 15:12:24 +0100
commita8c1b2a33947ea2f811a82960ecd785d2609f2fa (patch)
tree06b8b1f9e2690dc3bf808c2b72bd0fa9f84f9940 /print.c
parentc1ce37fff39b13c79fcfbbba8dfea2f6b1f365fb (diff)
downloadtcpdump-a8c1b2a33947ea2f811a82960ecd785d2609f2fa.tar.gz
No more need for ndo_invalid_header in struct netdissect_options
Because we now stop decoding packet when header length(s) is/are invalid, there is no more need to keep the invalid header flag out of pretty_print_packet function.
Diffstat (limited to 'print.c')
-rw-r--r--print.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/print.c b/print.c
index 7ab74727..70a0043c 100644
--- a/print.c
+++ b/print.c
@@ -313,32 +313,32 @@ pretty_print_packet(netdissect_options *ndo, const struct pcap_pkthdr *h,
const u_char *sp, u_int packets_captured)
{
u_int hdrlen;
+ int invalid_header = 0;
if(ndo->ndo_packet_number)
ND_PRINT("%5u ", packets_captured);
/* Sanity checks on packet length / capture length */
- ndo->ndo_invalid_header = 0;
if(h->caplen == 0) {
- ndo->ndo_invalid_header = 1;
+ invalid_header = 1;
ND_PRINT("[Invalid header: caplen==0");
}
if (h->len == 0) {
- if (!ndo->ndo_invalid_header) {
- ndo->ndo_invalid_header = 1;
+ if (!invalid_header) {
+ invalid_header = 1;
ND_PRINT("[Invalid header:");
} else
ND_PRINT(",");
ND_PRINT(" len==0");
} else if (h->len < h->caplen) {
- if (!ndo->ndo_invalid_header) {
- ndo->ndo_invalid_header = 1;
+ if (!invalid_header) {
+ invalid_header = 1;
ND_PRINT("[Invalid header:");
} else
ND_PRINT(",");
ND_PRINT(" len(%u) < caplen(%u)", h->len, h->caplen);
}
- if (ndo->ndo_invalid_header) {
+ if (invalid_header) {
ND_PRINT("]\n");
return;
}