OSDN Git Service

Fix memory corruption of BLE whitelist hashmap
authorNitin Arora <niarora@codeaurora.org>
Fri, 21 Aug 2015 19:34:14 +0000 (12:34 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Tue, 25 Aug 2015 16:31:11 +0000 (09:31 -0700)
When adding devices to the whitelist for LE background connections, a
local variable is used as the hashmap key, preventing any successful
lookups going forward. Thus the device will repeatedly add the same
device to the whitelist and preventing successful connections going
forward.

Bug: 23423602
Change-Id: I3d2590c0a1dd66c6e1864ea53f875a713660b645

stack/btm/btm_ble_bgconn.c

index fb9dc79..2107577 100644 (file)
@@ -76,7 +76,7 @@ static void background_connection_add(bt_bdaddr_t *address) {
   if (!connection) {
     connection = osi_calloc(sizeof(background_connection_t));
     connection->address = *address;
-    hash_map_set(background_connections, address, connection);
+    hash_map_set(background_connections, &(connection->address), connection);
   }
 }