diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2017-01-11 12:54:45 +0000 |
---|---|---|
committer | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2017-01-18 09:16:41 +0100 |
commit | 857ec6e800ec772f5a6b9f76268d189d70f000b6 (patch) | |
tree | d6119bd58fc53c09d398ef64ed4e3102446382ed /print-fr.c | |
parent | 0db4dcafe5ae38201d3869c96a96cb714d82ff35 (diff) | |
download | tcpdump-857ec6e800ec772f5a6b9f76268d189d70f000b6.tar.gz |
pass correct caplen to other functions as well
In ethertype_print(), isoclns_print() and snap_print() adjust the length
arithmetics along the same lines as for ether_print() in the previous
commit. Where done, the current pointer is not greater than snapend so
that the difference (i.e. caplen) is never negative.
This does not fix a reported issue but the problem was very likely to be
there.
Diffstat (limited to 'print-fr.c')
-rw-r--r-- | print-fr.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -276,7 +276,7 @@ fr_print(netdissect_options *ndo, if (ethertype_print(ndo, extracted_ethertype, p+addr_len+ETHERTYPE_LEN, length-addr_len-ETHERTYPE_LEN, - length-addr_len-ETHERTYPE_LEN, + ndo->ndo_snapend-p-addr_len-ETHERTYPE_LEN, NULL, NULL) == 0) /* ether_type not known, probably it wasn't one */ ND_PRINT((ndo, "UI %02x! ", p[addr_len])); @@ -329,11 +329,11 @@ fr_print(netdissect_options *ndo, case NLPID_CLNP: case NLPID_ESIS: case NLPID_ISIS: - isoclns_print(ndo, p - 1, length + 1, length + 1); /* OSI printers need the NLPID field */ + isoclns_print(ndo, p - 1, length + 1, ndo->ndo_snapend - p + 1); /* OSI printers need the NLPID field */ break; case NLPID_SNAP: - if (snap_print(ndo, p, length, length, NULL, NULL, 0) == 0) { + if (snap_print(ndo, p, length, ndo->ndo_snapend - p, NULL, NULL, 0) == 0) { /* ether_type not known, print raw packet */ if (!ndo->ndo_eflag) fr_hdr_print(ndo, length + hdr_len, hdr_len, |