OSDN Git Service

Add missing brackets for "if" statement inside BTM_ConfirmReqReply()
authorJack He <siyuanh@google.com>
Fri, 4 Nov 2016 18:18:32 +0000 (11:18 -0700)
committerJack He <siyuanh@google.com>
Fri, 4 Nov 2016 18:53:32 +0000 (11:53 -0700)
This fixes a potential NULL-pointer reference crash in case
btm_find_dev() returns NULL.

Test: mm -j 8
Change-Id: Ic154b872ca84b4e9e8bc57803a4d9ee7c1665204

stack/btm/btm_sec.cc

index 7662b70..cb08205 100644 (file)
@@ -1537,9 +1537,10 @@ void BTM_ConfirmReqReply(tBTM_STATUS res, BD_ADDR bd_addr)
 
         if (res == BTM_SUCCESS)
         {
-            if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL)
+            if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL) {
                 p_dev_rec->sec_flags |= BTM_SEC_LINK_KEY_AUTHED;
                 p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
+            }
         }
 
         btsnd_hcic_user_conf_reply (bd_addr, true);