aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Labedzki <michal.labedzki@tieto.com>2016-01-21 09:23:42 +0100
committerMichael Mann <mmann78@netscape.net>2016-02-05 18:57:29 +0000
commitc09d894f7446aa394d04710876ed631af22b1497 (patch)
treedd17ff934afd6f386f8149d4869c6209bf60174b
parentfb033d0f39eda3f3937ae265c422ad907b179f42 (diff)
Fix some Coverity issue
>>> CID 1349726: Incorrect expression (COPY_PASTE_ERROR) >>> "tvb_reported_length_remaining" in "tvb_reported_length_remaining(tvb, offset)" looks like a copy-paste error. >>> CID 1349727: Incorrect expression (COPY_PASTE_ERROR) >>> "tree" in "dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo, >>> CID 1349728: (DEADCODE) >>> Execution cannot reach this expression "0" inside statement "(0 && ((__s1_len = __builti...". >>> CID 1306904: Logically dead code (DEADCODE) >>> Execution cannot reach this statement "tap_hci_summary->interface_...". Change-Id: I5f99e37e6d5fac39da7082649caa8373d06bb808 Reviewed-on: https://code.wireshark.org/review/13739 Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-bthci_cmd.c12
-rw-r--r--epan/dissectors/packet-bthci_evt.c60
-rw-r--r--epan/dissectors/packet-btle.c6
-rw-r--r--extcap/androiddump.c4
4 files changed, 29 insertions, 53 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 86b61ed1cc..cdab7bca0b 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -3235,13 +3235,9 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_OPCODE;
tap_hci_summary->ogf = ogf;
@@ -5483,7 +5479,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
new_tvb = tvb_new_subset_length(tvb, offset, length);
- if (!dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo, tree, TRUE, bluetooth_eir_ad_data)) {
+ if (!dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo, entry_tree, TRUE, bluetooth_eir_ad_data)) {
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_data, tvb, offset, length, ENC_NA);
expert_add_info(pinfo, sub_item, &ei_eir_ad_undecoded);
}
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index b99ad06d99..8870b688fb 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -816,13 +816,9 @@ static void send_hci_summary_status_tap(guint8 status, packet_info *pinfo, bluet
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS;
tap_hci_summary->status = status;
@@ -840,13 +836,9 @@ static void send_hci_summary_pending_tap(packet_info *pinfo, bluetooth_data_t *b
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS_PENDING;
tap_hci_summary->status = 0;
@@ -861,13 +853,9 @@ static void send_hci_summary_reason_tap(guint8 reason, packet_info *pinfo, bluet
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_REASON;
tap_hci_summary->reason = reason;
@@ -1522,13 +1510,9 @@ dissect_bthci_evt_hardware_error(tvbuff_t *tvb, int offset, packet_info *pinfo,
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_HARDWARE_ERROR;
tap_hci_summary->hardware_error = tvb_get_guint8(tvb, offset - 1);
@@ -1712,13 +1696,9 @@ dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
tap_hci_summary->ogf = ogf;
@@ -4019,13 +3999,9 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
- if (bluetooth_data) {
- tap_hci_summary->interface_id = bluetooth_data->interface_id;
- tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
- } else {
- tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
- tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
- }
+
+ tap_hci_summary->interface_id = bluetooth_data->interface_id;
+ tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT;
tap_hci_summary->event = evt_code;
diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c
index 5a48b143d4..f79749a015 100644
--- a/epan/dissectors/packet-btle.c
+++ b/epan/dissectors/packet-btle.c
@@ -389,10 +389,10 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
else
interface_id = HCI_INTERFACE_DEFAULT;
- if (bluetooth_data)
- adapter_id = bluetooth_data->adapter_id;
- else if (ubertooth_data)
+ if (ubertooth_data)
adapter_id = ubertooth_data->bus_id << 8 | ubertooth_data->device_address;
+ else if (bluetooth_data)
+ adapter_id = bluetooth_data->adapter_id;
else
adapter_id = HCI_ADAPTER_DEFAULT;
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 5e8eab9c42..92778fb30d 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -752,6 +752,7 @@ static int list_interfaces(const char *adb_server_ip, unsigned short *adb_server
char *data_str;
char pid[16];
+ memset(pid, 0, sizeof(pid));
response[data_length] = '\0';
data_str = strchr(response, '\n');
@@ -828,6 +829,7 @@ static int list_interfaces(const char *adb_server_ip, unsigned short *adb_server
char *data_str;
char pid[16];
+ memset(pid, 0, sizeof(pid));
response[data_length] = '\0';
data_str = strchr(response, '\n');
@@ -2377,6 +2379,8 @@ static int capture_android_wifi_tcpdump(char *interface, char *fifo,
}
}
}
+
+ closesocket(sock);
return 0;
}