aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-02-26 14:38:57 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2015-03-02 18:28:17 +0000
commit768e37b792e5de46e03a396fc416d0a42b71243b (patch)
tree129ee0221476c392997dc6fd7343ac646db03e65 /epan/dissectors
parent77d2dc589241a6ade357a133574126abe1b408ef (diff)
Bluetooth: Fix tools/checkAPI issues
Change-Id: I8ffbd4a0da800594d9888f6a30612d4fc5273119 Reviewed-on: https://code.wireshark.org/review/7474 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-bt3ds.c4
-rw-r--r--epan/dissectors/packet-btavctp.c4
-rw-r--r--epan/dissectors/packet-btavdtp.c26
-rw-r--r--epan/dissectors/packet-btavrcp.c18
-rw-r--r--epan/dissectors/packet-bthci_cmd.c40
-rw-r--r--epan/dissectors/packet-bthci_evt.c10
-rw-r--r--epan/dissectors/packet-bthci_sco.c6
-rw-r--r--epan/dissectors/packet-bthcrp.c28
-rw-r--r--epan/dissectors/packet-bthfp.c20
-rw-r--r--epan/dissectors/packet-bthsp.c26
-rw-r--r--epan/dissectors/packet-btl2cap.c18
-rw-r--r--epan/dissectors/packet-btle.c38
-rw-r--r--epan/dissectors/packet-btmcap.c16
-rw-r--r--epan/dissectors/packet-btobex.c70
-rw-r--r--epan/dissectors/packet-btrfcomm.c31
-rw-r--r--epan/dissectors/packet-btsap.c4
-rw-r--r--epan/dissectors/packet-btsdp.c20
-rw-r--r--epan/dissectors/packet-btsmp.c2
-rw-r--r--epan/dissectors/packet-hci_h1.c2
-rw-r--r--epan/dissectors/packet-hci_h4.c2
-rw-r--r--epan/dissectors/packet-hci_mon.c14
-rw-r--r--epan/dissectors/packet-hci_usb.c11
22 files changed, 207 insertions, 203 deletions
diff --git a/epan/dissectors/packet-bt3ds.c b/epan/dissectors/packet-bt3ds.c
index a5ccf10dac..5456ba01bc 100644
--- a/epan/dissectors/packet-bt3ds.c
+++ b/epan/dissectors/packet-bt3ds.c
@@ -107,9 +107,9 @@ dissect_bt3ds(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
offset += 1;
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_expert(main_tree, pinfo, &ei_unexpected_data, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c
index 2cd0869fe7..390900ea65 100644
--- a/epan/dissectors/packet-btavctp.c
+++ b/epan/dissectors/packet-btavctp.c
@@ -151,7 +151,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
return 0;
l2cap_data = (btl2cap_data_t *) data;
- ti = proto_tree_add_item(tree, proto_btavctp, tvb, offset, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btavctp, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA);
btavctp_tree = proto_item_add_subtree(ti, ett_btavctp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVCTP");
@@ -222,7 +222,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
avctp_data->chandle = l2cap_data->chandle;
avctp_data->psm = l2cap_data->psm;
- length = tvb_ensure_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
/* reassembling */
next_tvb = tvb_new_subset_length(tvb, offset, length);
diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c
index cf4f572d05..a04b5433b7 100644
--- a/epan/dissectors/packet-btavdtp.c
+++ b/epan/dissectors/packet-btavdtp.c
@@ -653,8 +653,8 @@ dissect_sep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset,
when SEP is provided in ACP role, otherwise INT frequently asking for it
*/
direction = (pinfo->p2p_dir == P2P_DIR_SENT) ? P2P_DIR_RECV : P2P_DIR_SENT;
- items = tvb_length_remaining(tvb, offset) / 2;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ items = tvb_reported_length_remaining(tvb, offset) / 2;
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
seid = tvb_get_guint8(tvb, offset);
in_use = seid & 0x02;
seid = seid >> 2;
@@ -1013,7 +1013,7 @@ dissect_capabilities(tvbuff_t *tvb, packet_info *pinfo,
gint media_type = 0;
gint media_codec_type = 0;
- capabilities_item = proto_tree_add_item(tree, hf_btavdtp_capabilities, tvb, offset, tvb_length(tvb) - offset, ENC_NA);
+ capabilities_item = proto_tree_add_item(tree, hf_btavdtp_capabilities, tvb, offset, tvb_reported_length(tvb) - offset, ENC_NA);
capabilities_tree = proto_item_add_subtree(capabilities_item, ett_btavdtp_capabilities);
if (codec)
@@ -1031,7 +1031,7 @@ dissect_capabilities(tvbuff_t *tvb, packet_info *pinfo,
if (configuration_offset)
*configuration_offset = 0;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
service_category = tvb_get_guint8(tvb, offset);
losc = tvb_get_guint8(tvb, offset + 1);
service_item = proto_tree_add_none_format(capabilities_tree, hf_btavdtp_service, tvb, offset, 2 + losc, "Service: %s", val_to_str_const(service_category, service_category_vals, "RFD"));
@@ -1554,7 +1554,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
}
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
} else if (!(l2cap_data->local_cid == channels_info->control_local_cid &&
l2cap_data->remote_cid == channels_info->control_remote_cid)) {
/* Unknown Stream Channel */
@@ -1563,7 +1563,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
col_append_fstr(pinfo->cinfo, COL_INFO, "Unknown channel stream on cid=0x%04x", l2cap_data->cid);
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
/* Signaling Channel */
@@ -1834,7 +1834,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
case SIGNAL_ID_START:
if (message_type == MESSAGE_TYPE_COMMAND) {
i_sep = 1;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset,
SEID_ACP, i_sep, NULL,
interface_id, adapter_id, chandle, frame_number);
@@ -1909,7 +1909,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
case SIGNAL_ID_SUSPEND:
if (message_type == MESSAGE_TYPE_COMMAND) {
i_sep = 1;
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
offset = dissect_seid(tvb, pinfo, btavdtp_tree, offset,
SEID_ACP, i_sep, NULL,
interface_id, adapter_id, chandle, frame_number);
@@ -1949,7 +1949,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
SEID_ACP, 0, NULL, interface_id,
adapter_id, chandle, frame_number);
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
}
if (message_type == MESSAGE_TYPE_REJECT) {
@@ -1959,7 +1959,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
case SIGNAL_ID_DELAY_REPORT:
if (message_type == MESSAGE_TYPE_COMMAND) {
@@ -1984,7 +1984,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
LABEL_data:
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_item(btavdtp_tree, hf_btavdtp_data, tvb, offset, -1, ENC_NA);
}
@@ -3050,7 +3050,7 @@ dissect_bta2dp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
bluetooth_add_address(pinfo, &pinfo->net_dst, sep_data.stream_number, "BT A2DP", pinfo->fd->num, FALSE, &bta2dp_codec_info);
call_dissector(rtp_handle, tvb, pinfo, tree);
}
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
return offset;
}
@@ -3281,7 +3281,7 @@ dissect_btvdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
bluetooth_add_address(pinfo, &pinfo->net_dst, 0, "BT VDP", pinfo->fd->num, TRUE, &btvdp_codec_info);
call_dissector(rtp_handle, tvb, pinfo, tree);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
return offset;
}
diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c
index e68670d981..b1b6e78e67 100644
--- a/epan/dissectors/packet-btavrcp.c
+++ b/epan/dissectors/packet-btavrcp.c
@@ -1007,7 +1007,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint event_id;
guint packet_type;
guint parameter_length;
- guint length;
+ gint length;
wmem_tree_key_t key[7];
guint32 k_interface_id;
guint32 k_adapter_id;
@@ -1039,7 +1039,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(tree, hf_btavrcp_bt_pdu_id, tvb, offset, 1, ENC_BIG_ENDIAN);
} else {
- if (tvb_length_remaining(tvb, offset) == 0) {
+ if (tvb_reported_length_remaining(tvb, offset) == 0) {
col_append_str(pinfo->cinfo, COL_INFO, " - No PDU ID");
return offset;
}
@@ -1072,9 +1072,9 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (parameter_length == 0) return offset;
- length = tvb_ensure_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (packet_type == PACKET_TYPE_START) {
- if (pinfo->fd->flags.visited == 0) {
+ if (pinfo->fd->flags.visited == 0 && tvb_captured_length_remaining(tvb, offset) == length) {
k_interface_id = interface_id;
k_adapter_id = adapter_id;
k_chandle = chandle;
@@ -1124,7 +1124,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_append_str(pinfo->cinfo, COL_INFO, " [start]");
return offset;
} else if (packet_type == PACKET_TYPE_CONTINUE) {
- if (pinfo->fd->flags.visited == 0) {
+ if (pinfo->fd->flags.visited == 0 && tvb_captured_length_remaining(tvb, offset) == length) {
k_interface_id = interface_id;
k_adapter_id = adapter_id;
k_chandle = chandle;
@@ -1672,7 +1672,7 @@ dissect_vendor_dependant(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_append_fstr(pinfo->cinfo, COL_INFO, " - Volume: %u%%", volume_percent);
break;
default:
- proto_tree_add_item(tree, hf_btavrcp_data, tvb, offset, -1, ENC_NA);
+ proto_tree_add_item(tree, hf_btavrcp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
offset = tvb_reported_length(tvb);
break;
}
@@ -1924,7 +1924,7 @@ dissect_browsing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
folder_depth = tvb_get_guint8(tvb, offset);
offset += 1;
- pitem = proto_tree_add_none_format(tree, hf_btavrcp_currect_path, tvb, offset, -1, "Current Path: /");
+ pitem = proto_tree_add_none_format(tree, hf_btavrcp_currect_path, tvb, offset, tvb_reported_length_remaining(tvb, offset), "Current Path: /");
col_append_str(pinfo->cinfo, COL_INFO, "Current Path: /");
ptree = proto_item_add_subtree(pitem, ett_btavrcp_path);
@@ -2124,7 +2124,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
return 0;
avctp_data = (btavctp_data_t *) data;
- ti = proto_tree_add_item(tree, proto_btavrcp, tvb, offset, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btavrcp, tvb, offset, tvb_captured_length_remaining(tvb, offset), ENC_NA);
btavrcp_tree = proto_item_add_subtree(ti, ett_btavrcp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AVRCP");
@@ -2335,7 +2335,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
if (tvb_reported_length_remaining(tvb, offset) > 0) {
- pitem = proto_tree_add_item(btavrcp_tree, hf_btavrcp_data, tvb, offset, -1, ENC_NA);
+ pitem = proto_tree_add_item(btavrcp_tree, hf_btavrcp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
expert_add_info(pinfo, pitem, &ei_btavrcp_unexpected_data);
}
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index d50ad2f276..0060f91a78 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -1879,7 +1879,7 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree_add_item(tree, hf_bthci_cmd_dedicated_amp_key_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset++;
proto_tree_add_item(tree, hf_bthci_cmd_dedicated_amp_key, tvb, offset, -1, ENC_NA);
- offset+=tvb_length_remaining(tvb, offset);
+ offset+=tvb_reported_length_remaining(tvb, offset);
break;
case 0x0037: /* Disconnect Physical Link */
@@ -1931,12 +1931,12 @@ dissect_link_control_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo,
case 0x0044: /* Receive Synchronization Train */
/* TODO: Implement above cases */
proto_tree_add_expert(tree, pinfo, &ei_command_undecoded, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -2081,7 +2081,7 @@ dissect_link_policy_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -2681,12 +2681,12 @@ dissect_host_controller_baseband_cmd(tvbuff_t *tvb, int offset, packet_info *pin
case 0x078: /* Write Synchronization Train Parameters */
/* TODO: Implement above cases */
proto_tree_add_expert(tree, pinfo, &ei_command_undecoded, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -2716,7 +2716,7 @@ dissect_informational_parameters_cmd(tvbuff_t *tvb, int offset, packet_info *pin
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -2765,7 +2765,7 @@ dissect_status_parameters_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
proto_tree_add_item(tree, hf_bthci_cmd_amp_remaining_assoc_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset+=2;
proto_tree_add_item(tree, hf_bthci_cmd_amp_assoc_fragment, tvb, offset, -1, ENC_NA);
- offset+=tvb_length_remaining(tvb, offset);
+ offset+=tvb_reported_length_remaining(tvb, offset);
break;
case 0x000D: /* Set Triggered Clock Capture */
@@ -2775,12 +2775,12 @@ dissect_status_parameters_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
case 0x000C: /* Get MWS Transport Layer Configuration */
/* TODO: Implement above cases */
proto_tree_add_expert(tree, pinfo, &ei_command_undecoded, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -2817,12 +2817,12 @@ dissect_testing_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tre
case 0x009: /* AMP Test */
/* TODO: Implement above cases */
proto_tree_add_expert(tree, pinfo, &ei_command_undecoded, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -3043,7 +3043,7 @@ dissect_le_cmd(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree,
default:
proto_tree_add_expert(tree, pinfo, &ei_command_unknown_command, tvb, offset, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -3210,14 +3210,14 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
default:
proto_tree_add_expert(bthci_cmd_tree, pinfo, &ei_command_unknown_command, tvb, 3, -1);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
}
}
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_tree_add_expert(bthci_cmd_tree, pinfo, &ei_command_parameter_unexpected, tvb, offset, -1);
- /*offset += tvb_length_remaining(tvb, offset);*/
+ offset += tvb_reported_length_remaining(tvb, offset);
}
return offset;
@@ -4744,7 +4744,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gint64 end_offset;
guint i_uuid;
- data_size = tvb_length(tvb);
+ data_size = tvb_reported_length(tvb);
while (offset < data_size) {
length = tvb_get_guint8(tvb, offset);
@@ -5111,9 +5111,9 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
- if (tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_item(tree, hf_btcommon_eir_ad_unused, tvb, offset, -1, ENC_NA);
- offset = tvb_length(tvb);
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
+ proto_tree_add_item(tree, hf_btcommon_eir_ad_unused, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
+ offset = tvb_reported_length(tvb);
}
return offset + data_size;
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index aff94bf188..ddc9bad5e3 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -1343,7 +1343,7 @@ dissect_bthci_evt_loopback_command(tvbuff_t *tvb, int offset,
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, bluetooth_data);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
return offset;
}
@@ -2958,7 +2958,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
proto_tree_add_item(tree, hf_bthci_evt_amp_remaining_assoc_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
proto_tree_add_item(tree, hf_bthci_evt_amp_assoc_fragment, tvb, offset, -1, ENC_NA);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
case 0x140b: /* Write Remote AMP Assoc */
@@ -3113,7 +3113,7 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset,
default:
proto_tree_add_expert(tree, pinfo, &ei_event_unknown_command, tvb, offset, tvb_captured_length_remaining(tvb, offset));
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
}
@@ -3793,7 +3793,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
case 0xfe: /* Bluetooth Logo Testing */
/* TODO: Implement above cases */
proto_tree_add_expert(bthci_evt_tree, pinfo, &ei_event_undecoded, tvb, offset, tvb_captured_length_remaining(tvb, offset));
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
case 0xff: /* Vendor-Specific */
@@ -3826,7 +3826,7 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
default:
proto_tree_add_expert(bthci_evt_tree, pinfo, &ei_event_unknown_event, tvb, offset, tvb_captured_length_remaining(tvb, offset));
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
}
diff --git a/epan/dissectors/packet-bthci_sco.c b/epan/dissectors/packet-bthci_sco.c
index 517455c430..d4b34800e0 100644
--- a/epan/dissectors/packet-bthci_sco.c
+++ b/epan/dissectors/packet-bthci_sco.c
@@ -68,7 +68,7 @@ dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
localhost_name_entry_t *localhost_name_entry;
- ti = proto_tree_add_item(tree, proto_bthci_sco, tvb, offset, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_bthci_sco, tvb, offset, tvb_captured_length(tvb), ENC_NA);
bthci_sco_tree = proto_item_add_subtree(ti, ett_bthci_sco);
switch (pinfo->p2p_dir) {
@@ -226,9 +226,9 @@ dissect_bthci_sco(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void
SET_ADDRESS(&pinfo->src, AT_STRINGZ, (int)strlen(localhost_addr_name) + 1, localhost_addr_name);
}
- proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_data, tvb, offset, -1, ENC_NA);
+ proto_tree_add_item(bthci_sco_tree, hf_bthci_sco_data, tvb, offset, tvb_reported_length(tvb), ENC_NA);
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-bthcrp.c b/epan/dissectors/packet-bthcrp.c
index 23594e37c3..9f7625bafa 100644
--- a/epan/dissectors/packet-bthcrp.c
+++ b/epan/dissectors/packet-bthcrp.c
@@ -163,10 +163,10 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
"Parameter length is shorter than 2 in response");
}
- if (parameter_length < tvb_length_remaining(tvb, offset)) {
+ if (parameter_length < tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, pitem, &ei_bthcrp_control_parameter_length,
"Parameter length is shorter than payload length");
- } else if (parameter_length > tvb_length_remaining(tvb, offset)) {
+ } else if (parameter_length > tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, pitem, &ei_bthcrp_control_parameter_length,
"Parameter length is larger than payload length");
}
@@ -177,9 +177,9 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
if (control_pdu_id >= 0x8000) {
- if (tvb_length_remaining(tvb, offset)) {
- proto_tree_add_item(tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA);
- offset += tvb_length_remaining(tvb, offset);
+ if (tvb_reported_length_remaining(tvb, offset)) {
+ proto_tree_add_item(tree, hf_bthcrp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
} else switch(control_pdu_id) {
case 0x0001: /* CR_DataChannelCreditGrant */
@@ -248,10 +248,10 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
} else {
guint8 *id;
- proto_tree_add_item(tree, hf_bthcrp_control_1284_id, tvb, offset, -1, ENC_ASCII | ENC_NA);
- id = tvb_get_string_enc(NULL, tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII);
+ proto_tree_add_item(tree, hf_bthcrp_control_1284_id, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ id = tvb_get_string_enc(NULL, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_ASCII);
col_append_fstr(pinfo->cinfo, COL_INFO, " - 1284 ID: %s", id);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
break;
case 0x0007: /* CR_SoftReset */
@@ -310,7 +310,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
next_tvb = tvb_new_subset_remaining(tvb, offset);
call_dissector(data_handle, next_tvb, pinfo, tree);
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
return offset;
}
@@ -338,9 +338,9 @@ dissect_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (notification_pdu_id >= 0x8000) {
proto_item_append_text(pitem, " (Vendor Specific)");
col_append_str(pinfo->cinfo, COL_INFO, " (Vendor Specific)");
- if (tvb_length_remaining(tvb, offset)) {
- proto_tree_add_item(tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA);
- offset += tvb_length_remaining(tvb, offset);
+ if (tvb_reported_length_remaining(tvb, offset)) {
+ proto_tree_add_item(tree, hf_bthcrp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
} else if (notification_pdu_id != 0x001) {
proto_item_append_text(pitem, " (Reserved)");
@@ -493,10 +493,10 @@ dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
col_append_fstr(pinfo->cinfo, COL_INFO, "HCRP stream (CID: 0x%04X)", l2cap_data->cid);
}
- if (tvb_length_remaining(tvb, offset)) {
+ if (tvb_reported_length_remaining(tvb, offset)) {
proto_item *pitem;
- pitem = proto_tree_add_item(main_tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA);
+ pitem = proto_tree_add_item(main_tree, hf_bthcrp_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
expert_add_info(pinfo, pitem, &ei_bthcrp_unexpected_data);
}
diff --git a/epan/dissectors/packet-bthfp.c b/epan/dissectors/packet-bthfp.c
index aa10b2075b..b556fb0cbf 100644
--- a/epan/dissectors/packet-bthfp.c
+++ b/epan/dissectors/packet-bthfp.c
@@ -1512,9 +1512,9 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean next;
void *data;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length <= 0)
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
if (!command_number) {
proto_tree_add_item(tree, hf_data, tvb, offset, length, ENC_NA | ENC_ASCII);
@@ -1756,7 +1756,7 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
i_char += i_char_fix;
proto_item_set_len(command_item, i_char);
} else {
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length < 0)
length = 0;
offset += length;
@@ -1908,9 +1908,9 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (role == ROLE_UNKNOWN) {
col_append_fstr(pinfo->cinfo, COL_INFO, "Data: %s",
- tvb_format_text(tvb, 0, tvb_length(tvb)));
+ tvb_format_text(tvb, 0, tvb_reported_length(tvb)));
proto_tree_add_item(main_tree, hf_data, tvb, 0, -1, ENC_NA | ENC_ASCII);
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
/* save fragments */
@@ -1977,7 +1977,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
fragment->role = role;
fragment->index = previous_fragment ? previous_fragment->index + previous_fragment->length : 0;
fragment->reassemble_state = REASSEMBLE_FRAGMENT;
- fragment->length = tvb_length(tvb);
+ fragment->length = tvb_reported_length(tvb);
fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length);
fragment->previous_fragment = previous_fragment;
tvb_memcpy(tvb, fragment->data, offset, fragment->length);
@@ -1985,7 +1985,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
wmem_tree_insert32_array(fragments, key, fragment);
/* Detect reassemble end character: \r for HS or \n for AG */
- length = tvb_length(tvb);
+ length = tvb_reported_length(tvb);
at_stream = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, length, ENC_ASCII);
reassemble_start_offset = 0;
@@ -2134,7 +2134,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (fragment->index > 0 && fragment->length > 0) {
proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
- tvb_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ tvb_reported_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
reassembled_tvb = tvb_new_child_real_data(tvb, at_data,
fragment->index + fragment->length, fragment->index + fragment->length);
add_new_data_source(pinfo, reassembled_tvb, "Reassembled HFP");
@@ -2144,7 +2144,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (reassembled_tvb) {
guint reassembled_offset = 0;
- while (tvb_length(reassembled_tvb) > reassembled_offset) {
+ while (tvb_reported_length(reassembled_tvb) > reassembled_offset) {
reassembled_offset = dissect_at_command(reassembled_tvb,
pinfo, main_tree, reassembled_offset, role, command_number);
command_number += 1;
@@ -2152,7 +2152,7 @@ dissect_bthfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
offset = tvb_captured_length(tvb);
} else {
- while (tvb_length(tvb) > (guint) offset) {
+ while (tvb_reported_length(tvb) > (guint) offset) {
offset = dissect_at_command(tvb, pinfo, main_tree, offset, role, command_number);
command_number += 1;
}
diff --git a/epan/dissectors/packet-bthsp.c b/epan/dissectors/packet-bthsp.c
index bf90e537aa..0b3cfe2e7c 100644
--- a/epan/dissectors/packet-bthsp.c
+++ b/epan/dissectors/packet-bthsp.c
@@ -296,9 +296,9 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean next;
void *data;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length <= 0)
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
if (!command_number) {
proto_tree_add_item(tree, hf_data, tvb, offset, length, ENC_NA | ENC_ASCII);
@@ -597,7 +597,7 @@ dissect_at_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
i_char += i_char_fix;
proto_item_set_len(command_item, i_char);
} else {
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length < 0)
length = 0;
proto_item_set_len(command_item, length);
@@ -763,9 +763,9 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (role == ROLE_UNKNOWN) {
col_append_fstr(pinfo->cinfo, COL_INFO, "Data: %s",
- tvb_format_text(tvb, 0, tvb_length(tvb)));
- proto_tree_add_item(main_tree, hf_data, tvb, 0, -1, ENC_NA | ENC_ASCII);
- return tvb_length(tvb);
+ tvb_format_text(tvb, 0, tvb_reported_length(tvb)));
+ proto_tree_add_item(main_tree, hf_data, tvb, 0, tvb_reported_length(tvb), ENC_NA | ENC_ASCII);
+ return tvb_reported_length(tvb);
}
/* save fragments */
@@ -832,7 +832,7 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
fragment->role = role;
fragment->index = previous_fragment ? previous_fragment->index + previous_fragment->length : 0;
fragment->reassemble_state = REASSEMBLE_FRAGMENT;
- fragment->length = tvb_length(tvb);
+ fragment->length = tvb_reported_length(tvb);
fragment->data = (guint8 *) wmem_alloc(wmem_file_scope(), fragment->length);
fragment->previous_fragment = previous_fragment;
tvb_memcpy(tvb, fragment->data, offset, fragment->length);
@@ -840,7 +840,7 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
wmem_tree_insert32_array(fragments, key, fragment);
/* Detect reassemble end character: \r for HS or \n for AG */
- length = tvb_length(tvb);
+ length = tvb_reported_length(tvb);
at_stream = tvb_get_string_enc(wmem_packet_scope(), tvb, 0, length, ENC_ASCII);
reassemble_start_offset = 0;
@@ -989,7 +989,7 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (fragment->index > 0 && fragment->length > 0) {
proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
- tvb_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ tvb_reported_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
reassembled_tvb = tvb_new_child_real_data(tvb, at_data,
fragment->index + fragment->length, fragment->index + fragment->length);
add_new_data_source(pinfo, reassembled_tvb, "Reassembled HSP");
@@ -999,24 +999,24 @@ dissect_bthsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
if (reassembled_tvb) {
guint reassembled_offset = 0;
- while (tvb_length(reassembled_tvb) > reassembled_offset) {
+ while (tvb_reported_length(reassembled_tvb) > reassembled_offset) {
reassembled_offset = dissect_at_command(reassembled_tvb,
pinfo, main_tree, reassembled_offset, role, command_number);
command_number += 1;
}
} else {
- while (tvb_length(tvb) > (guint) offset) {
+ while (tvb_reported_length(tvb) > (guint) offset) {
offset = dissect_at_command(tvb, pinfo, main_tree, offset, role, command_number);
command_number += 1;
}
}
} else {
col_append_fstr(pinfo->cinfo, COL_INFO, "Fragment: %s",
- tvb_format_text_wsp(tvb, offset, tvb_length_remaining(tvb, offset)));
+ tvb_format_text_wsp(tvb, offset, tvb_reported_length_remaining(tvb, offset)));
pitem = proto_tree_add_item(main_tree, hf_fragmented, tvb, 0, 0, ENC_NA);
PROTO_ITEM_SET_GENERATED(pitem);
proto_tree_add_item(main_tree, hf_fragment, tvb, offset,
- tvb_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
+ tvb_reported_length_remaining(tvb, offset), ENC_ASCII | ENC_NA);
}
return offset;
diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c
index 2a10f62646..712bc2418c 100644
--- a/epan/dissectors/packet-btl2cap.c
+++ b/epan/dissectors/packet-btl2cap.c
@@ -1461,7 +1461,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
tvbuff_t *next_tvb;
- next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
+ next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), length);
col_append_str(pinfo->cinfo, COL_INFO, "Connection oriented channel");
@@ -1637,7 +1637,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/*pass up to higher layer if we have a complete packet*/
if (segment == 0x00) {
- next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset) - 2, length);
+ next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset) - 2, length);
}
if (next_tvb) {
if (psm) {
@@ -1679,15 +1679,15 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* not a known fixed PSM, try to find a registered service to a dynamic PSM */
if (!dissector_try_uint_new(l2cap_service_dissector_table, uuid, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
/* unknown protocol. declare as data */
- proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), ENC_NA);
+ proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_reported_length(next_tvb), ENC_NA);
}
}
}
else {
- proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_length(next_tvb), ENC_NA);
+ proto_tree_add_item(btl2cap_tree, hf_btl2cap_payload, next_tvb, 0, tvb_reported_length(next_tvb), ENC_NA);
}
}
- offset += (tvb_length_remaining(tvb, offset) - 2);
+ offset += tvb_reported_length_remaining(tvb, offset) - 2;
proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
return offset;
@@ -2002,7 +2002,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(btl2cap_tree, hf_btl2cap_psm, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
+ next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), length);
/* call next dissector */
if (!dissector_try_uint_new(l2cap_psm_dissector_table, (guint32) psm, next_tvb, pinfo, tree, TRUE, l2cap_data)) {
@@ -2049,13 +2049,13 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_txseq, tvb, offset, 2, ENC_LITTLE_ENDIAN);
proto_tree_add_item(ti_control_subtree, hf_btl2cap_control_type, tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, tvb_length(tvb)-2, 2, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(btl2cap_tree, hf_btl2cap_fcs, tvb, tvb_reported_length(tvb) - 2, 2, ENC_LITTLE_ENDIAN);
- next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset)-2, length);
+ next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset)-2, length);
}
}
else {
- next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), length);
+ next_tvb = tvb_new_subset(tvb, offset, tvb_captured_length_remaining(tvb, offset), length);
}
/* call next dissector */
if (next_tvb && !dissector_try_uint_new(l2cap_cid_dissector_table, (guint32) cid,
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 26f3178a6e..a5fb530f57 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -449,12 +449,12 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_DST, addr);
}
- if (tvb_length_remaining(tvb, offset) > 3) {
- next_tvb = tvb_new_subset_length(tvb, offset, tvb_length_remaining(tvb, offset) - 3);
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
call_dissector(btcommon_ad_handle, next_tvb, pinfo, btle_tree);
}
- offset += tvb_length_remaining(tvb, offset) - 3;
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
break;
case 0x01: /* ADV_DIRECT_IND */
@@ -530,15 +530,15 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
p_add_proto_data(wmem_file_scope(), pinfo, proto_bluetooth, BLUETOOTH_DATA_DST, addr);
}
- sub_item = proto_tree_add_item(btle_tree, hf_scan_response_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3, ENC_NA);
+ sub_item = proto_tree_add_item(btle_tree, hf_scan_response_data, tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3, ENC_NA);
sub_tree = proto_item_add_subtree(sub_item, ett_scan_response_data);
- if (tvb_length_remaining(tvb, offset) > 3) {
- next_tvb = tvb_new_subset_length(tvb, offset, tvb_length_remaining(tvb, offset) - 3);
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ next_tvb = tvb_new_subset_length(tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
call_dissector(btcommon_ad_handle, next_tvb, pinfo, sub_tree);
}
- offset += tvb_length_remaining(tvb, offset) - 3;
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
break;
case 0x05: /* CONNECT_REQ */
@@ -625,9 +625,9 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
default:
- if (tvb_length_remaining(tvb, offset) > 3) {
- proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3);
- offset += tvb_length_remaining(tvb, offset) - 3;
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
}
}
} else { /* data PDU */
@@ -758,9 +758,9 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
case 0x0B: /* LL_PAUSE_ENC_RSP */
case 0x12: /* LL_PING_REQ */
case 0x13: /* LL_PING_RSP */
- if (tvb_length_remaining(tvb, offset) > 3) {
- proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3);
- offset += tvb_length_remaining(tvb, offset) - 3;
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
}
break;
@@ -905,17 +905,17 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
default:
- if (tvb_length_remaining(tvb, offset) > 3) {
- proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3);
- offset += tvb_length_remaining(tvb, offset) - 3;
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
}
}
break;
default:
- if (tvb_length_remaining(tvb, offset) > 3) {
- proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_length_remaining(tvb, offset) - 3);
- offset += tvb_length_remaining(tvb, offset) - 3;
+ if (tvb_reported_length_remaining(tvb, offset) > 3) {
+ proto_tree_add_expert(btle_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_reported_length_remaining(tvb, offset) - 3);
+ offset += tvb_reported_length_remaining(tvb, offset) - 3;
}
}
diff --git a/epan/dissectors/packet-btmcap.c b/epan/dissectors/packet-btmcap.c
index decb40faf6..d5fcbb2429 100644
--- a/epan/dissectors/packet-btmcap.c
+++ b/epan/dissectors/packet-btmcap.c
@@ -110,7 +110,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
guint32 bluetooth_clock_sync_time;
guint64 timestamp_sync_time;
- main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, -1, ENC_NA);
+ main_item = proto_tree_add_item(tree, proto_btmcap, tvb, offset, tvb_captured_length(tvb), ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_btmcap);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MCAP");
@@ -291,24 +291,24 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
col_append_str(pinfo->cinfo, COL_INFO, " (Reserved)");
}
- if ((op_code == 0x03 || op_code == 0x05 || op_code == 0x07) && tvb_length_remaining(tvb, offset)) {
+ if ((op_code == 0x03 || op_code == 0x05 || op_code == 0x07) && tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, pitem, &ei_btmcap_response_parameters_bad,
"The Response Parameters for MD_RECONNECT_MDL_RSP shall have length zero.");
- } else if (tvb_length_remaining(tvb, offset)) {
- pitem = proto_tree_add_item(main_tree, hf_btmcap_response_parameters, tvb, offset, -1, ENC_NA);
+ } else if (tvb_reported_length_remaining(tvb, offset)) {
+ pitem = proto_tree_add_item(main_tree, hf_btmcap_response_parameters, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
if (response_code != 0x00) {
expert_add_info_format(pinfo, pitem, &ei_btmcap_response_parameters_bad,
"When the Response Code is not Success, the Response Parameters shall have length zero.");
}
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
}
}
}
- if (tvb_length_remaining(tvb, offset)) {
- pitem = proto_tree_add_item(main_tree, hf_btmcap_data, tvb, offset, -1, ENC_NA);
+ if (tvb_reported_length_remaining(tvb, offset)) {
+ pitem = proto_tree_add_item(main_tree, hf_btmcap_data, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
expert_add_info(pinfo, pitem, &ei_btmcap_unexpected_data);
- offset = tvb_length(tvb);
+ offset = tvb_reported_length(tvb);
}
return offset;
diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c
index c19e5200eb..58317ba859 100644
--- a/epan/dissectors/packet-btobex.c
+++ b/epan/dissectors/packet-btobex.c
@@ -665,7 +665,7 @@ dissect_raw_application_parameters(tvbuff_t *tvb, proto_tree *tree, gint offset,
while (parameters_length > 0) {
parameter_id = tvb_get_guint8(tvb, offset);
parameter_item = proto_tree_add_none_format(tree, hf_application_parameter, tvb, offset,
- -1, "Parameter: 0x%02x", parameter_id);
+ tvb_captured_length_remaining(tvb, offset), "Parameter: 0x%02x", parameter_id);
parameter_tree = proto_item_add_subtree(parameter_item, ett_btobex_application_parameters);
proto_tree_add_item(parameter_tree, hf_application_parameter_id, tvb, offset,
@@ -1087,7 +1087,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
gint parameters_length;
guint8 hdr_id, i;
- if (tvb_length_remaining(tvb, offset) > 0) {
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
proto_item *hdrs;
hdrs = proto_tree_add_item(tree, hf_headers, tvb, offset, item_length, ENC_NA);
hdrs_tree = proto_item_add_subtree(hdrs, ett_btobex_hdrs);
@@ -1096,7 +1096,7 @@ dissect_headers(proto_tree *tree, tvbuff_t *tvb, int offset, packet_info *pinfo,
return offset;
}
- while (tvb_length_remaining(tvb, offset) > 0) {
+ while (tvb_reported_length_remaining(tvb, offset) > 0) {
hdr_id = tvb_get_guint8(tvb, offset);
switch(0xC0 & hdr_id)
@@ -1476,40 +1476,42 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
complete = FALSE;
- if (fragment_get(&btobex_reassembly_table, pinfo, pinfo->p2p_dir, NULL)) {
- /* not the first fragment */
- frag_msg = fragment_add_seq_next(&btobex_reassembly_table,
- tvb, 0, pinfo, pinfo->p2p_dir, NULL,
- tvb_length(tvb), TRUE);
+ if (tvb_captured_length(tvb) == tvb_reported_length(tvb)) {
+ if (fragment_get(&btobex_reassembly_table, pinfo, pinfo->p2p_dir, NULL)) {
+ /* not the first fragment */
+ frag_msg = fragment_add_seq_next(&btobex_reassembly_table,
+ tvb, 0, pinfo, pinfo->p2p_dir, NULL,
+ tvb_captured_length(tvb), TRUE);
- new_tvb = process_reassembled_data(tvb, 0, pinfo,
- "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree);
+ new_tvb = process_reassembled_data(tvb, 0, pinfo,
+ "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree);
- pinfo->fragmented = TRUE;
- } else {
- if (tvb_length(tvb) < tvb_get_ntohs(tvb, offset+1)) {
- /* first fragment in a sequence */
- no_of_segments = tvb_get_ntohs(tvb, offset+1)/tvb_length(tvb);
- if (tvb_get_ntohs(tvb, offset+1) > (no_of_segments * tvb_length(tvb)))
- no_of_segments++;
+ pinfo->fragmented = TRUE;
+ } else {
+ if (tvb_reported_length(tvb) < tvb_get_ntohs(tvb, offset+1)) {
+ /* first fragment in a sequence */
+ no_of_segments = tvb_get_ntohs(tvb, offset + 1) / tvb_reported_length(tvb);
+ if (tvb_get_ntohs(tvb, offset+1) > (no_of_segments * tvb_reported_length(tvb)))
+ no_of_segments++;
- frag_msg = fragment_add_seq_next(&btobex_reassembly_table,
- tvb, 0, pinfo, pinfo->p2p_dir, NULL,
- tvb_length(tvb), TRUE);
+ frag_msg = fragment_add_seq_next(&btobex_reassembly_table,
+ tvb, 0, pinfo, pinfo->p2p_dir, NULL,
+ tvb_reported_length(tvb), TRUE);
- fragment_set_tot_len(&btobex_reassembly_table,
- pinfo, pinfo->p2p_dir, NULL,
- no_of_segments-1);
+ fragment_set_tot_len(&btobex_reassembly_table,
+ pinfo, pinfo->p2p_dir, NULL,
+ no_of_segments-1);
- new_tvb = process_reassembled_data(tvb, 0, pinfo,
- "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree);
+ new_tvb = process_reassembled_data(tvb, 0, pinfo,
+ "Reassembled Obex packet", frag_msg, &btobex_frag_items, NULL, tree);
- pinfo->fragmented = TRUE;
+ pinfo->fragmented = TRUE;
+ }
+ else if (tvb_reported_length(tvb) == tvb_get_ntohs(tvb, offset+1)) {
+ /* non-fragmented */
+ complete = TRUE;
+ pinfo->fragmented = FALSE;
}
- else if (tvb_length(tvb) == tvb_get_ntohs(tvb, offset+1)) {
- /* non-fragmented */
- complete = TRUE;
- pinfo->fragmented = FALSE;
}
}
@@ -1530,7 +1532,7 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/* fully dissectable packet ready */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "OBEX");
- ti = proto_tree_add_item(tree, proto_btobex, next_tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btobex, next_tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btobex);
sub_item = proto_tree_add_uint(st, hf_profile, next_tvb, 0, 0, profile);
@@ -1656,9 +1658,9 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
default:
- if (length == 0 && tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_expert(st, pinfo, &ei_unexpected_data, tvb, offset, tvb_length_remaining(tvb, offset));
- offset += tvb_length_remaining(tvb, offset);
+ if (length == 0 && tvb_reported_length_remaining(tvb, offset) > 0) {
+ proto_tree_add_expert(st, pinfo, &ei_unexpected_data, tvb, offset, tvb_reported_length_remaining(tvb, offset));
+ offset += tvb_reported_length_remaining(tvb, offset);
break;
} else if (length == 0) break;
diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c
index 8f2f9c9902..eb6c92c226 100644
--- a/epan/dissectors/packet-btrfcomm.c
+++ b/epan/dissectors/packet-btrfcomm.c
@@ -628,7 +628,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return 0;
l2cap_data = (btl2cap_data_t *) data;
- ti = proto_tree_add_item(tree, proto_btrfcomm, tvb, offset, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btrfcomm, tvb, offset, tvb_captured_length(tvb), ENC_NA);
rfcomm_tree = proto_item_add_subtree(ti, ett_btrfcomm);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RFCOMM");
@@ -808,7 +808,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
/* len */
offset = get_le_multi_byte_value(tvb, offset, ctrl_tree, &length, hf_mcc_len);
- if (length > (guint32) tvb_length_remaining(tvb, offset)) {
+ if (length > (guint32) tvb_reported_length_remaining(tvb, offset)) {
expert_add_info_format(pinfo, ctrl_tree, &ei_btrfcomm_mcc_length_bad, "Huge MCC length: %u", length);
return offset;
}
@@ -1218,11 +1218,11 @@ dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
gboolean is_at_cmd;
guint i, length;
- length = tvb_length(tvb);
+ length = tvb_captured_length(tvb);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DUN");
- ti = proto_tree_add_item(tree, proto_btdun, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btdun, tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btdun);
is_at_cmd = TRUE;
@@ -1236,7 +1236,7 @@ dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
(pinfo->p2p_dir == P2P_DIR_SENT) ? "Sent" : "Rcvd",
tvb_format_text(tvb, 0, length));
- proto_tree_add_item(st, hf_dun_at_cmd, tvb, 0, -1, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(st, hf_dun_at_cmd, tvb, 0, tvb_reported_length(tvb), ENC_ASCII|ENC_NA);
}
else {
/* ... or raw PPP */
@@ -1252,7 +1252,7 @@ dissect_btdun(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
}
}
- return length;
+ return tvb_reported_length(tvb);
}
void
@@ -1295,11 +1295,12 @@ dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_item *ti;
proto_tree *st;
gboolean ascii_only;
- guint i, length = tvb_length(tvb);
+ guint i;
+ guint length = tvb_captured_length(tvb);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP");
- ti = proto_tree_add_item(tree, proto_btspp, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btspp, tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btspp);
length = MIN(length, 60);
@@ -1312,12 +1313,12 @@ dissect_btspp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
col_add_fstr(pinfo->cinfo, COL_INFO, "%s \"%s%s\"",
(pinfo->p2p_dir == P2P_DIR_SENT) ? "Sent" : "Rcvd",
tvb_format_text(tvb, 0, length),
- (tvb_length(tvb) > length) ? "..." : "");
+ (tvb_captured_length(tvb) > length) ? "..." : "");
}
- proto_tree_add_item(st, hf_spp_data, tvb, 0, -1, ENC_NA);
+ proto_tree_add_item(st, hf_spp_data, tvb, 0, tvb_reported_length(tvb), ENC_NA);
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
void
@@ -1361,17 +1362,17 @@ dissect_btgnss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GNSS");
- main_item = proto_tree_add_item(tree, proto_btgnss, tvb, 0, -1, ENC_NA);
+ main_item = proto_tree_add_item(tree, proto_btgnss, tvb, 0, tvb_captured_length(tvb), ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_btgnss);
col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
(pinfo->p2p_dir == P2P_DIR_SENT) ? "Sent" : "Rcvd",
- tvb_format_text(tvb, 0, tvb_length(tvb)));
+ tvb_format_text(tvb, 0, tvb_captured_length(tvb)));
/* GNSS using NMEA-0183 protocol, but it is not available */
- proto_tree_add_item(main_tree, hf_gnss_data, tvb, 0, -1, ENC_NA | ENC_ASCII);
+ proto_tree_add_item(main_tree, hf_gnss_data, tvb, 0, tvb_reported_length(tvb), ENC_NA | ENC_ASCII);
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
void
diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c
index 8d8eb77bd8..94b82ac50a 100644
--- a/epan/dissectors/packet-btsap.c
+++ b/epan/dissectors/packet-btsap.c
@@ -574,8 +574,8 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
tvb, offset, 0, "Too many parameters");
}
- if (tvb_length(tvb) > offset)
- proto_tree_add_expert(tree, pinfo, &ei_unexpected_data, tvb, offset, -1);
+ if (tvb_reported_length(tvb) > offset)
+ proto_tree_add_expert(tree, pinfo, &ei_unexpected_data, tvb, offset, tvb_reported_length_remaining(tvb, offset));
return offset;
}
diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c
index e3be71cae9..0b09d30180 100644
--- a/epan/dissectors/packet-btsdp.c
+++ b/epan/dissectors/packet-btsdp.c
@@ -1336,7 +1336,7 @@ dissect_continuation_state(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
proto_item *cont_item;
guint length;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length == 0) {
proto_tree_add_expert(tree, pinfo, &ei_btsdp_continuation_state_none, tvb, offset, -1);
} else if (length > 17) {
@@ -1435,7 +1435,7 @@ reassemble_continuation_state(tvbuff_t *tvb, packet_info *pinfo,
if (is_first) *is_first = TRUE;
if (is_continued) *is_continued = TRUE;
- length = tvb_length_remaining(tvb, offset);
+ length = tvb_reported_length_remaining(tvb, offset);
if (length == 0) {
return offset;
} else if (length > 17) {
@@ -1832,7 +1832,7 @@ dissect_data_element(proto_tree *tree, proto_tree **next_tree,
}
pitem = proto_tree_add_item(ptree, hf_data_element_value, tvb, offset, 0, ENC_NA);
- if (length > tvb_length_remaining(tvb, offset)) {
+ if (length > tvb_reported_length_remaining(tvb, offset)) {
expert_add_info(pinfo, pitem, &ei_data_element_value_large);
length = 0;
}
@@ -3654,7 +3654,7 @@ dissect_sdp_service_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset,
}
if (!attribute_only) {
- attribute_item = proto_tree_add_none_format(tree, hf_service_attribute, tvb, offset, -1,
+ attribute_item = proto_tree_add_none_format(tree, hf_service_attribute, tvb, offset, tvb_reported_length_remaining(tvb, offset),
"Service Attribute: %s%s (0x%x)", profile_speficic, attribute_name, id);
attribute_tree = proto_item_add_subtree(attribute_item, ett_btsdp_attribute);
} else {
@@ -3685,7 +3685,7 @@ dissect_sdp_service_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset = new_offset;
if (!attribute_only){
- attribute_value_item = proto_tree_add_item(attribute_tree, hf_service_attribute_value, tvb, offset, -1, ENC_NA);
+ attribute_value_item = proto_tree_add_item(attribute_tree, hf_service_attribute_value, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
attribute_value_tree = proto_item_add_subtree(attribute_value_item, ett_btsdp_attribute_value);
dissect_sdp_type(attribute_value_tree, pinfo, tvb, offset, id, uuid,
@@ -4115,7 +4115,7 @@ dissect_sdp_service_search_response(proto_tree *tree, tvbuff_t *tvb,
gint new_offset = 0;
gint new_length;
- new_length = tvb_length(new_tvb);
+ new_length = tvb_reported_length(new_tvb);
reassembled_item = proto_tree_add_item(tree, (is_continued) ? hf_partial_record_handle_list : hf_reassembled_record_handle_list,new_tvb, 0, new_length, ENC_NA);
proto_item_append_text(reassembled_item, " [count = %u]", new_length / 4);
@@ -4214,7 +4214,7 @@ dissect_sdp_service_attribute_response(proto_tree *tree, tvbuff_t *tvb,
reassembled_item = proto_tree_add_item(tree,
(is_continued) ? hf_partial_attribute_list : hf_reassembled_attribute_list,
- new_tvb, 0, tvb_length(new_tvb), ENC_NA);
+ new_tvb, 0, tvb_reported_length(new_tvb), ENC_NA);
reassembled_tree = proto_item_add_subtree(reassembled_item, ett_btsdp_reassembled);
PROTO_ITEM_SET_GENERATED(reassembled_item);
@@ -4339,13 +4339,13 @@ dissect_sdp_service_search_attribute_response(proto_tree *tree, tvbuff_t *tvb,
reassembled_item = proto_tree_add_item(tree,
(is_continued) ? hf_partial_attribute_list : hf_reassembled_attribute_list,
- new_tvb, 0, tvb_length(new_tvb), ENC_NA);
+ new_tvb, 0, tvb_reported_length(new_tvb), ENC_NA);
reassembled_tree = proto_item_add_subtree(reassembled_item, ett_btsdp_reassembled);
PROTO_ITEM_SET_GENERATED(reassembled_item);
if (!is_continued)
dissect_sdp_service_attribute_list_array(reassembled_tree, new_tvb, 0,
- pinfo, tvb_length(new_tvb), &uuid, l2cap_data);
+ pinfo, tvb_reported_length(new_tvb), &uuid, l2cap_data);
}
return offset;
@@ -4367,7 +4367,7 @@ dissect_btsdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
return 0;
l2cap_data = (btl2cap_data_t *) data;
- ti = proto_tree_add_item(tree, proto_btsdp, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btsdp, tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btsdp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SDP");
diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c
index 5a11c1e38a..6fba3038d8 100644
--- a/epan/dissectors/packet-btsmp.c
+++ b/epan/dissectors/packet-btsmp.c
@@ -187,7 +187,7 @@ dissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
proto_tree *st;
guint8 opcode;
- ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, tvb_captured_length(tvb), ENC_NA);
st = proto_item_add_subtree(ti, ett_btsmp);
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMP");
diff --git a/epan/dissectors/packet-hci_h1.c b/epan/dissectors/packet-hci_h1.c
index 18380e597d..e6bfae446a 100644
--- a/epan/dissectors/packet-hci_h1.c
+++ b/epan/dissectors/packet-hci_h1.c
@@ -111,7 +111,7 @@ dissect_hci_h1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
call_dissector(data_handle, next_tvb, pinfo, tree);
}
- return tvb_length(tvb);
+ return tvb_reported_length(tvb);
}
diff --git a/epan/dissectors/packet-hci_h4.c b/epan/dissectors/packet-hci_h4.c
index df0d61c3aa..2c22589523 100644
--- a/epan/dissectors/packet-hci_h4.c
+++ b/epan/dissectors/packet-hci_h4.c
@@ -110,7 +110,7 @@ dissect_hci_h4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
call_dissector(data_handle, next_tvb, pinfo, tree);
}
- return tvb_length(tvb);
+ return 1;
}
diff --git a/epan/dissectors/packet-hci_mon.c b/epan/dissectors/packet-hci_mon.c
index d6bf045823..ce0a089148 100644
--- a/epan/dissectors/packet-hci_mon.c
+++ b/epan/dissectors/packet-hci_mon.c
@@ -211,31 +211,31 @@ dissect_hci_mon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
break;
case 0x02: /* HCI Command Packet */
call_dissector_with_data(bthci_cmd_handle, next_tvb, pinfo, tree, bluetooth_data);
- offset = tvb_length(tvb);
+ offset = tvb_reported_length(tvb);
break;
case 0x03: /* HCI Event Packet */
call_dissector_with_data(bthci_evt_handle, next_tvb, pinfo, tree, bluetooth_data);
- offset = tvb_length(tvb);
+ offset = tvb_reported_length(tvb);
break;
case 0x04: /* ACL Tx Packet */
case 0x05: /* ACL Rx Packet */
call_dissector_with_data(bthci_acl_handle, next_tvb, pinfo, tree, bluetooth_data);
- offset = tvb_length(tvb);
+ offset = tvb_reported_length(tvb);
break;
case 0x06: /* SCO Tx Packet */
case 0x07: /* SCO Rx Packet */
call_dissector_with_data(bthci_sco_handle, next_tvb, pinfo, tree, bluetooth_data);
- offset = tvb_length(tvb);
+ offset = tvb_reported_length(tvb);
break;
}
- if (tvb_length_remaining(tvb, offset) > 0) {
- proto_tree_add_expert(hci_mon_tree, pinfo, &ei_unknown_data, tvb, offset, -1);
- offset = tvb_length(tvb);
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
+ proto_tree_add_expert(hci_mon_tree, pinfo, &ei_unknown_data, tvb, offset, tvb_reported_length_remaining(tvb, offset));
+ offset = tvb_reported_length(tvb);
}
/* NOTE: Oops... HCI_MON have special packet with length 0, but there is a pseudo-header with certain infos,
diff --git a/epan/dissectors/packet-hci_usb.c b/epan/dissectors/packet-hci_usb.c
index dbd87a11b8..42c49d3e70 100644
--- a/epan/dissectors/packet-hci_usb.c
+++ b/epan/dissectors/packet-hci_usb.c
@@ -172,7 +172,8 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
bluetooth_data->adapter_disconnect_in_frame = &max_disconnect_in_frame;
next_tvb = tvb_new_subset_remaining(tvb, offset);
- if (!pinfo->fd->flags.visited && usb_conv_info->endpoint <= 0x02) {
+ if (!pinfo->fd->flags.visited && usb_conv_info->endpoint <= 0x02 &&
+ tvb_captured_length(tvb) == tvb_reported_length(tvb)) {
fragment_info_t *fragment_info;
fragment_info = (fragment_info_t *) wmem_tree_lookup32(fragment_info_table, session_id);
@@ -199,11 +200,11 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
}
}
- fragment_info->remaining_length -= tvb_ensure_length_remaining(tvb, offset);
+ fragment_info->remaining_length -= tvb_reported_length_remaining(tvb, offset);
fragment_add_seq_check(&hci_usb_reassembly_table,
tvb, offset, pinfo, session_id, NULL,
- fragment_info->fragment_id, tvb_length_remaining(tvb, offset), (fragment_info->remaining_length == 0) ? FALSE : TRUE);
+ fragment_info->fragment_id, tvb_reported_length_remaining(tvb, offset), (fragment_info->remaining_length == 0) ? FALSE : TRUE);
if (fragment_info->remaining_length > 0)
fragment_info->fragment_id += 1;
else
@@ -220,7 +221,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
pitem = proto_tree_add_item(ttree, hf_bthci_usb_packet_complete, tvb, offset, -1, ENC_NA);
PROTO_ITEM_SET_GENERATED(pitem);
- if (reassembled->len > tvb_ensure_length_remaining(tvb, offset)) {
+ if (reassembled->len > (guint) tvb_reported_length_remaining(tvb, offset)) {
next_tvb = process_reassembled_data(tvb, 0, pinfo,
"Reassembled HCI_USB",
reassembled, &hci_usb_msg_frag_items,
@@ -250,7 +251,7 @@ dissect_hci_usb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(ttree, hf_bthci_usb_data, tvb, offset, -1, ENC_NA);
}
- offset += tvb_length_remaining(tvb, offset);
+ offset += tvb_reported_length_remaining(tvb, offset);
pinfo->p2p_dir = p2p_dir_save;