From c8f3c1d9a3c0ba9fabb44d14ea8a55a234449e0b Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 25 Dec 2012 22:35:54 +0000 Subject: 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 --- epan/dissectors/packet-bthci_evt.c | 87 ++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'epan/dissectors/packet-bthci_evt.c') 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; -- cgit v1.2.3