aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthci_vendor.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2015-06-18 09:10:55 +0200
committerMichal Labedzki <michal.labedzki@tieto.com>2015-06-19 13:20:57 +0000
commit7ec7e43f3be20d7c79b5b62252ed368aca79e54a (patch)
tree3cb0c60d98b8f00095c165c8293bc036cae6fe4b /epan/dissectors/packet-bthci_vendor.c
parent9e4b299d2c7e7dce5e5277b4bcc4d6b11f13ef2b (diff)
Bluetooth: Coverity fixes
Try to fix Coverity issues in Bluetooth HCI and androiddump. Change-Id: Id2ed35130eb4dbb0698b7a54afccdba56af62bfd Reviewed-on: https://code.wireshark.org/review/8983 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Diffstat (limited to 'epan/dissectors/packet-bthci_vendor.c')
-rw-r--r--epan/dissectors/packet-bthci_vendor.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/epan/dissectors/packet-bthci_vendor.c b/epan/dissectors/packet-bthci_vendor.c
index e6ef90d587..62872ac275 100644
--- a/epan/dissectors/packet-bthci_vendor.c
+++ b/epan/dissectors/packet-bthci_vendor.c
@@ -368,8 +368,17 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
guint8 status;
guint8 subcode;
guint8 condition;
+ guint32 interface_id;
+ guint32 adapter_id;
bluetooth_data = (bluetooth_data_t *) data;
+ if (bluetooth_data) {
+ interface_id = bluetooth_data->interface_id;
+ adapter_id = bluetooth_data->adapter_id;
+ } else {
+ interface_id = HCI_INTERFACE_DEFAULT;
+ adapter_id = HCI_ADAPTER_DEFAULT;
+ }
main_item = proto_tree_add_item(tree, proto_bthci_vendor_broadcom, tvb, 0, tvb_captured_length(tvb), ENC_NA);
main_tree = proto_item_add_subtree(main_item, ett_bthci_vendor_broadcom);
@@ -401,7 +410,7 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
switch(ocf) {
case 0x0001: /* Write BDADDR */
- offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, TRUE, bluetooth_data->interface_id, bluetooth_data->adapter_id, bd_addr);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, TRUE, interface_id, adapter_id, bd_addr);
/* TODO: This is command, but in respose (event Command Complete) there is a status for that,
so write bdaddr can fail, but we store bdaddr as valid for now... */
@@ -582,12 +591,12 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_tree_add_item(main_tree, hf_le_multi_advertising_address_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, interface_id, adapter_id, NULL);
proto_tree_add_item(main_tree, hf_le_multi_advertising_address_type, tvb, offset, 1, ENC_NA);
offset += 1;
- offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, interface_id, adapter_id, NULL);
proto_tree_add_bitmask(main_tree, tvb, offset, hf_le_multi_advertising_channel_map, ett_channel_map, hfx_le_multi_advertising_channel_map, ENC_NA);
offset += 1;
@@ -613,7 +622,7 @@ dissect_bthci_vendor_broadcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
break;
case 0x04: /* Set Random Address */
- offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, bluetooth_data->interface_id, bluetooth_data->adapter_id, NULL);
+ offset = dissect_bd_addr(hf_bd_addr, pinfo, main_tree, tvb, offset, FALSE, interface_id, adapter_id, NULL);
proto_tree_add_item(main_tree, hf_le_multi_advertising_instance_id, tvb, offset, 1, ENC_NA);
offset += 1;