aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-01-09 15:13:35 -0800
committerGuy Harris <guy@alum.mit.edu>2017-01-09 23:14:10 +0000
commit8604ed2ef8dabce9abc384b5583ec573348bc920 (patch)
tree8d6266f369cd14c32169cec11373d7c6b8b984b7
parent2b482cd0c3f85b0cb20819ad0ce1d612c72f4abd (diff)
Consistently use tvb_reported_length_remaining().
That's the amount of data left in the packet; perhaps not all of it was *captured*, and using tvb_reported_length_remaining() will throw an exception, but that's what *should* happen ("packet cut short" notification and all). Use tvb_new_subset_remaining() to get a tvbuff with everything after a certain point in the packet. Change-Id: I2512e58e23600f7e7bbce0126732b05997692a65 Reviewed-on: https://code.wireshark.org/review/19596 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-batadv.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c
index 0f960cf8a2..a591a8430b 100644
--- a/epan/dissectors/packet-batadv.c
+++ b/epan/dissectors/packet-batadv.c
@@ -949,7 +949,7 @@ static void dissect_batadv_v15(tvbuff_t *tvb, packet_info *pinfo,
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BATADV_???");
- length_remaining = tvb_captured_length_remaining(tvb, 0);
+ length_remaining = tvb_reported_length_remaining(tvb, 0);
if (length_remaining > 0) {
next_tvb = tvb_new_subset_remaining(tvb, 0);
call_data_dissector(next_tvb, pinfo, tree);
@@ -1621,7 +1621,7 @@ static void dissect_batadv_iv_ogm(tvbuff_t *tvb, packet_info *pinfo, proto_tree
switch (version) {
case 15:
while (offset != -1 &&
- tvb_captured_length_remaining(tvb, offset) >= IV_OGM_PACKET_V15_SIZE) {
+ tvb_reported_length_remaining(tvb, offset) >= IV_OGM_PACKET_V15_SIZE) {
offset = dissect_batadv_iv_ogm_v15(tvb, offset, pinfo, tree);
}
break;
@@ -2301,7 +2301,7 @@ static void dissect_batadv_icmp_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tre
length_remaining = tvb_reported_length_remaining(tvb, offset);
if (length_remaining > 0) {
- next_tvb = tvb_new_subset(tvb, offset, length_remaining, -1);
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
call_data_dissector(next_tvb, pinfo, tree);
}
}
@@ -2393,7 +2393,7 @@ static void dissect_batadv_icmp_v15(tvbuff_t *tvb, packet_info *pinfo,
offset += 2;
/* rr data available? */
- length_remaining = tvb_captured_length_remaining(tvb, offset);
+ length_remaining = tvb_reported_length_remaining(tvb, offset);
if (length_remaining >= BAT_RR_LEN * 6) {
dissect_batadv_icmp_rr_v15(batadv_icmp_tree, tvb, offset,
icmp_packeth->rr_ptr);
@@ -2402,9 +2402,9 @@ static void dissect_batadv_icmp_v15(tvbuff_t *tvb, packet_info *pinfo,
tap_queue_packet(batadv_tap, pinfo, icmp_packeth);
- length_remaining = tvb_captured_length_remaining(tvb, offset);
+ length_remaining = tvb_reported_length_remaining(tvb, offset);
if (length_remaining > 0) {
- next_tvb = tvb_new_subset(tvb, offset, length_remaining, -1);
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
call_data_dissector(next_tvb, pinfo, tree);
}
}
@@ -3741,7 +3741,7 @@ static void dissect_batadv_coded_v15(tvbuff_t *tvb, packet_info *pinfo,
tap_queue_packet(batadv_tap, pinfo, coded_packeth);
- length_remaining = tvb_captured_length_remaining(tvb, offset);
+ length_remaining = tvb_reported_length_remaining(tvb, offset);
if (length_remaining > 0) {
next_tvb = tvb_new_subset_remaining(tvb, offset);
@@ -3874,7 +3874,7 @@ static void dissect_batadv_tvlv_v15(tvbuff_t *tvb, packet_info *pinfo,
tvbuff_t *next_tvb;
proto_tree *batadv_tvlv_tree = NULL;
- while (offset != -1 && tvb_captured_length_remaining(tvb, offset) >= 4) {
+ while (offset != -1 && tvb_reported_length_remaining(tvb, offset) >= 4) {
type = tvb_get_guint8(tvb, offset + 0);
version = tvb_get_guint8(tvb, offset + 1);
@@ -4094,11 +4094,11 @@ static void dissect_batadv_tvlv_v15_tt(tvbuff_t *tvb, packet_info *pinfo,
offset = dissect_batadv_tvlv_v15_tt_vlan(tvb, pinfo, tree,
offset);
- length_remaining = tvb_captured_length_remaining(tvb, offset);
+ length_remaining = tvb_reported_length_remaining(tvb, offset);
while (length_remaining > 0) {
offset = dissect_batadv_tvlv_v15_tt_change(tvb, pinfo, tree,
offset);
- length_remaining = tvb_captured_length_remaining(tvb, offset);
+ length_remaining = tvb_reported_length_remaining(tvb, offset);
}
}