aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-03-14 19:47:22 -0700
committerGuy Harris <guy@alum.mit.edu>2014-03-15 02:47:50 +0000
commit50b3da03ca80404f9f1f411407c316bdfa0ea485 (patch)
treebd9346423c92dd398c91c81000d47bf452e3377a /wiretap
parent225635e5d2c59979336fad2045fa9fa962e72281 (diff)
More use of vwr->STATS_LEN to clarify what code is doing.
Change-Id: I9292f7b054f7b71727409deb062200a0301db5ee Reviewed-on: https://code.wireshark.org/review/665 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/vwr.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
index 74ac374ed7..e662016c2a 100644
--- a/wiretap/vwr.c
+++ b/wiretap/vwr.c
@@ -1115,10 +1115,15 @@ static int parse_s1_W_stats(vwr_t *vwr, struct wtap_pkthdr *phdr, guint8 *rec,
else
octets = 0;
- /* Sanity check the octets field to determine if it is OK (or segfaults result). */
- /* iff it's greater, then truncate to actual record size. */
- if (octets > (rec_size - 64))
- octets = (rec_size - 64);
+ /*
+ * Sanity check the octets field to determine if it's greater than
+ * the packet data available in the record - i.e., the record size
+ * minus the length of the statistics block.
+ *
+ * Truncate it if it is.
+ */
+ if (octets > (rec_size - vwr->STATS_LEN))
+ octets = (rec_size - vwr->STATS_LEN);
msdu_length = octets;