diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-01-09 22:18:49 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-01-10 06:19:37 +0000 |
commit | 7cd6906056922e4b8f68f1216d94eaa0809896fe (patch) | |
tree | 5a8c793f188ddda7f36a50369d00ff0de8f563e5 /epan/dissectors/packet-btatt.c | |
parent | 2a3b2360e15d49defde55240a5c1e171c7cade89 (diff) |
Rename tvb_new_subset() to tvb_new_subset_length_caplen().
This emphasizes that there is no such thing as *the* routine to
construct a subset tvbuff; you need to choose one of
tvb_new_subset_remaining() (if you want a new tvbuff that contains
everything past a certain point in an existing tvbuff),
tvb_new_subset_length() (if you want a subset that contains everything
past a certain point, for some number of bytes, in an existing tvbuff),
and tvb_new_subset_length_caplen() (for all other cases).
Many of the calls to tvb_new_subset_length_caplen() should really be
calling one of the other routines; that's the next step. (This also
makes it easier to find the calls that need fixing.)
Change-Id: Ieb3d676d8cda535451c119487d7cd3b559221f2b
Reviewed-on: https://code.wireshark.org/review/19597
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-btatt.c')
-rw-r--r-- | epan/dissectors/packet-btatt.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c index d366f0b5fb..2cc77e747a 100644 --- a/epan/dissectors/packet-btatt.c +++ b/epan/dissectors/packet-btatt.c @@ -4054,7 +4054,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * const gint **hfs; bluetooth_data_t *bluetooth_data = NULL; - tvb = tvb_new_subset(old_tvb, old_offset, length, length); + tvb = tvb_new_subset_length_caplen(old_tvb, old_offset, length, length); DISSECTOR_ASSERT(att_data); @@ -4470,13 +4470,13 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * sub_tree = proto_item_add_subtree(sub_item, ett_btatt_list); if (characteristic_dissector) - call_dissector_with_data(characteristic_dissector, tvb_new_subset(tvb, offset, tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2), pinfo, sub_tree, att_data); + call_dissector_with_data(characteristic_dissector, tvb_new_subset_length_caplen(tvb, offset, tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2), pinfo, sub_tree, att_data); sub_item = proto_tree_add_item(tree, hf_btatt_valid_range_upper_inclusive_value, tvb, offset + tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_btatt_list); if (characteristic_dissector) - call_dissector_with_data(characteristic_dissector, tvb_new_subset(tvb, offset + tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2), pinfo, sub_tree, att_data); + call_dissector_with_data(characteristic_dissector, tvb_new_subset_length_caplen(tvb, offset + tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2, tvb_reported_length_remaining(tvb, offset) / 2), pinfo, sub_tree, att_data); offset += tvb_reported_length_remaining(tvb, offset); } @@ -4556,7 +4556,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * proto_tree_add_item(tree, hf_btatt_value_trigger_setting_analog, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; } else if (value == 4) { - call_dissector_with_data(find_dissector("btgatt.uuid0x2a56"), tvb_new_subset(tvb, offset, 1, 1), pinfo, tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a56"), tvb_new_subset_length_caplen(tvb, offset, 1, 1), pinfo, tree, att_data); offset += 1; } else if (value == 5 || value == 6) { proto_tree_add_item(tree, hf_btatt_value_trigger_setting_analog_one, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -6282,10 +6282,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * if (bluetooth_gatt_has_no_parameter(att_data->opcode)) break; - call_dissector_with_data(find_dissector("btgatt.uuid0x2a56"), tvb_new_subset(tvb, offset, 1, 1), pinfo, tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a56"), tvb_new_subset_length_caplen(tvb, offset, 1, 1), pinfo, tree, att_data); offset += 1; - call_dissector_with_data(find_dissector("btgatt.uuid0x2a58"), tvb_new_subset(tvb, offset, 2, 2), pinfo, tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a58"), tvb_new_subset_length_caplen(tvb, offset, 2, 2), pinfo, tree, att_data); offset += 2; break; @@ -6382,7 +6382,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * sub_item = proto_tree_add_item(tree, hf_btatt_plx_spot_check_measurement_timestamp, tvb, offset, 7, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_btatt_value); - call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, sub_tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset_length_caplen(tvb, offset, 7, 7), pinfo, sub_tree, att_data); offset += 7; } @@ -8950,7 +8950,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * sub_item = proto_tree_add_item(tree, hf_btatt_ots_object_first_created, tvb, offset, 7, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_btatt_value); - call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, sub_tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset_length_caplen(tvb, offset, 7, 7), pinfo, sub_tree, att_data); offset += 7; break; @@ -8969,7 +8969,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * sub_item = proto_tree_add_item(tree, hf_btatt_ots_object_last_modified, tvb, offset, 7, ENC_NA); sub_tree = proto_item_add_subtree(sub_item, ett_btatt_value); - call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, sub_tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset_length_caplen(tvb, offset, 7, 7), pinfo, sub_tree, att_data); offset += 7; break; @@ -9176,10 +9176,10 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info * break; case 0x06: /* Created Between */ case 0x07: /* Modified Between */ - call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset_length_caplen(tvb, offset, 7, 7), pinfo, tree, att_data); offset += 7; - call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset(tvb, offset, 7, 7), pinfo, tree, att_data); + call_dissector_with_data(find_dissector("btgatt.uuid0x2a08"), tvb_new_subset_length_caplen(tvb, offset, 7, 7), pinfo, tree, att_data); offset += 7; break; |