Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/master c82ebd4b5 -> f04e1d0fe


nimble/host: fix find by address when addr is NULL

Addr is NULL when sending le connection request using whitelist.
Error occurs on bsp/native when trying to do ble_addr_cmp
with NULL addr. There is segmentation fault when reading from NULL.


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/536fee43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/536fee43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/536fee43

Branch: refs/heads/master
Commit: 536fee4310fadeb5a10732cbbca67593bd22ae44
Parents: c82ebd4
Author: Michał Narajowski <[email protected]>
Authored: Tue May 23 11:23:48 2017 +0200
Committer: Michał Narajowski <[email protected]>
Committed: Tue May 23 11:37:35 2017 +0200

----------------------------------------------------------------------
 net/nimble/host/src/ble_hs_conn.c | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/536fee43/net/nimble/host/src/ble_hs_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_conn.c 
b/net/nimble/host/src/ble_hs_conn.c
index 470f377..91a8456 100644
--- a/net/nimble/host/src/ble_hs_conn.c
+++ b/net/nimble/host/src/ble_hs_conn.c
@@ -293,6 +293,10 @@ ble_hs_conn_find_by_addr(const ble_addr_t *addr)
 
     BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
 
+    if (!addr) {
+        return NULL;
+    }
+
     SLIST_FOREACH(conn, &ble_hs_conns, bhc_next) {
         if (ble_addr_cmp(&conn->bhc_peer_addr, addr) == 0) {
             return conn;

Reply via email to