nimble/hci: Fix passing uninitialized data

In ble_hs_hci_evt_le_dir_adv_rpt function desc.length_data was passed
uninitialized to ble_gap_rx_adv_report. While it shouldn't be access
if desc.data is NULL it is better to just initialize it to 0.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4e7d5834
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4e7d5834
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4e7d5834

Branch: refs/heads/develop
Commit: 4e7d583466b6bd3917e984eb47d8b06f2e20c353
Parents: 1c49145
Author: Szymon Janc <[email protected]>
Authored: Mon Jan 30 16:43:37 2017 +0100
Committer: Szymon Janc <[email protected]>
Committed: Mon Jan 30 16:43:37 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_hs_hci_evt.c | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e7d5834/net/nimble/host/src/ble_hs_hci_evt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_hci_evt.c 
b/net/nimble/host/src/ble_hs_hci_evt.c
index 4305124..d622950 100644
--- a/net/nimble/host/src/ble_hs_hci_evt.c
+++ b/net/nimble/host/src/ble_hs_hci_evt.c
@@ -434,6 +434,7 @@ ble_hs_hci_evt_le_dir_adv_rpt(uint8_t subevent, uint8_t 
*data, int len)
 
     /* Data fields not present in a direct advertising report. */
     desc.data = NULL;
+    desc.length_data = 0;
 
     for (i = 0; i < num_reports; i++) {
         suboff = 0;

Reply via email to