summaryrefslogtreecommitdiff
path: root/print-fr.c
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2017-01-11 12:54:45 +0000
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2017-01-18 09:16:41 +0100
commit857ec6e800ec772f5a6b9f76268d189d70f000b6 (patch)
treed6119bd58fc53c09d398ef64ed4e3102446382ed /print-fr.c
parent0db4dcafe5ae38201d3869c96a96cb714d82ff35 (diff)
downloadtcpdump-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/print-fr.c b/print-fr.c
index 9c97bcb4..f400ddcd 100644
--- a/print-fr.c
+++ b/print-fr.c
@@ -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,