summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-bthci_cmd.c
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2016-01-11 17:51:55 +0100
committerMichal Labedzki <michal.labedzki@tieto.com>2016-02-06 11:09:48 +0000
commitcaf594bb3c8729dfe45a406c755f3f914393b675 (patch)
tree43657ae32fb657b64b2a65f07149ebcb3db4867f /epan/dissectors/packet-bthci_cmd.c
parent08cf5069882fff7b7452c8964981f2108614ff23 (diff)
downloadwireshark-caf594bb3c8729dfe45a406c755f3f914393b675.tar.gz
Bluetooth: HCI: Vendor: Add expert info if not all is dissected
If vendor dissector does not decode all bytes - it seems to be unexpected parameter. Also move vendor dissection tree under root as it is done for HCI CMD. >>> CID 1247678: Error handling issues (CHECKED_RETURN) >>> No check of the return value of "dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, tree, 1, bluetooth_data)". >>> CID 1247679: Error handling issues (CHECKED_RETURN) >>> No check of the return value of "dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, main_tree, 1, bluetooth_data)". Change-Id: Icdb8c1f166d5bc33cfc79c62d384ae416dfbf0cf Reviewed-on: https://code.wireshark.org/review/13737 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/packet-bthci_cmd.c')
-rw-r--r--epan/dissectors/packet-bthci_cmd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index cdab7bca0b..a2cef60a1c 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -3306,8 +3306,14 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
key[2].key = NULL;
hci_vendor_data = (hci_vendor_data_t *) wmem_tree_lookup32_array(bluetooth_data->hci_vendors, key);
- if (hci_vendor_data)
- dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, tree, TRUE, bluetooth_data);
+ if (hci_vendor_data) {
+ gint sub_offset;
+
+ sub_offset = dissector_try_uint_new(hci_vendor_table, hci_vendor_data->manufacturer, tvb, pinfo, tree, TRUE, bluetooth_data);
+
+ if (sub_offset > 0 && sub_offset < tvb_captured_length_remaining(tvb, offset))
+ proto_tree_add_expert(bthci_cmd_tree, pinfo, &ei_command_parameter_unexpected, tvb, offset + sub_offset, tvb_captured_length_remaining(tvb, sub_offset + offset));
+ }
}
}