aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-bthci_evt.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-25 22:35:54 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-25 22:35:54 +0000
commitc8f3c1d9a3c0ba9fabb44d14ea8a55a234449e0b (patch)
tree3667382110094fbfbf94047da1188dc159114b6f /epan/dissectors/packet-bthci_evt.c
parent01d97c7ee186d2f9ad78ee20d0d94adb914e5c64 (diff)
In dissect_bthci_evt_command_complete():
Make a loop counter a full-width integer, just to be sure. Do *NOT* assume that pinfo->private_data is non-null; I have at least one capture where it is null when dissect_bthci_evt_command_complete() is captured. svn path=/trunk/; revision=46743
Diffstat (limited to 'epan/dissectors/packet-bthci_evt.c')
-rw-r--r--epan/dissectors/packet-bthci_evt.c87
1 files changed, 45 insertions, 42 deletions
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index 6a492c931f..ff8bc96696 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -2063,7 +2063,8 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
proto_tree *opcode_tree;
proto_item *item;
gint16 timeout;
- guint8 num8, i;
+ guint8 num8;
+ guint i;
guint16 com_opcode;
guint32 accuracy;
guint8 bd_addr[6];
@@ -2184,25 +2185,26 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
localhost_bdaddr_entry_t *localhost_bdaddr_entry;
hci_data = (hci_data_t *) pinfo->private_data;
-
- k_interface_id = hci_data->interface_id;
- k_adapter_id = hci_data->adapter_id;
- k_frame_number = pinfo->fd->num;
-
- key[0].length = 1;
- key[0].key = &k_interface_id;
- key[1].length = 1;
- key[1].key = &k_adapter_id;
- key[2].length = 1;
- key[2].key = &k_frame_number;
- key[3].length = 0;
- key[3].key = NULL;
-
- localhost_bdaddr_entry = se_alloc(sizeof(localhost_bdaddr_entry_t));
- localhost_bdaddr_entry->interface_id = k_interface_id;
- localhost_bdaddr_entry->adapter_id = k_adapter_id;
- memcpy(localhost_bdaddr_entry->bd_addr, bd_addr, 6);
- se_tree_insert32_array(hci_data->localhost_bdaddr, key, localhost_bdaddr_entry);
+ if (hci_data != NULL) {
+ k_interface_id = hci_data->interface_id;
+ k_adapter_id = hci_data->adapter_id;
+ k_frame_number = pinfo->fd->num;
+
+ key[0].length = 1;
+ key[0].key = &k_interface_id;
+ key[1].length = 1;
+ key[1].key = &k_adapter_id;
+ key[2].length = 1;
+ key[2].key = &k_frame_number;
+ key[3].length = 0;
+ key[3].key = NULL;
+
+ localhost_bdaddr_entry = se_alloc(sizeof(localhost_bdaddr_entry_t));
+ localhost_bdaddr_entry->interface_id = k_interface_id;
+ localhost_bdaddr_entry->adapter_id = k_adapter_id;
+ memcpy(localhost_bdaddr_entry->bd_addr, bd_addr, 6);
+ se_tree_insert32_array(hci_data->localhost_bdaddr, key, localhost_bdaddr_entry);
+ }
}
break;
@@ -2386,28 +2388,29 @@ dissect_bthci_evt_command_complete(tvbuff_t *tvb, int offset, packet_info *pinfo
localhost_name_entry_t *localhost_name_entry;
hci_data = (hci_data_t *) pinfo->private_data;
-
- k_interface_id = hci_data->interface_id;
- k_adapter_id = hci_data->adapter_id;
- k_frame_number = pinfo->fd->num;
-
- name = tvb_get_ephemeral_string(tvb, offset, 248);
-
- key[0].length = 1;
- key[0].key = &k_interface_id;
- key[1].length = 1;
- key[1].key = &k_adapter_id;
- key[2].length = 1;
- key[2].key = &k_frame_number;
- key[3].length = 0;
- key[3].key = NULL;
-
- localhost_name_entry = se_alloc(sizeof(localhost_name_entry_t));
- localhost_name_entry->interface_id = k_interface_id;
- localhost_name_entry->adapter_id = k_adapter_id;
- localhost_name_entry->name = se_strdup(name);
-
- se_tree_insert32_array(hci_data->localhost_name, key, localhost_name_entry);
+ if (hci_data != NULL) {
+ k_interface_id = hci_data->interface_id;
+ k_adapter_id = hci_data->adapter_id;
+ k_frame_number = pinfo->fd->num;
+
+ name = tvb_get_ephemeral_string(tvb, offset, 248);
+
+ key[0].length = 1;
+ key[0].key = &k_interface_id;
+ key[1].length = 1;
+ key[1].key = &k_adapter_id;
+ key[2].length = 1;
+ key[2].key = &k_frame_number;
+ key[3].length = 0;
+ key[3].key = NULL;
+
+ localhost_name_entry = se_alloc(sizeof(localhost_name_entry_t));
+ localhost_name_entry->interface_id = k_interface_id;
+ localhost_name_entry->adapter_id = k_adapter_id;
+ localhost_name_entry->name = se_strdup(name);
+
+ se_tree_insert32_array(hci_data->localhost_name, key, localhost_name_entry);
+ }
}
offset += 248;