OSDN Git Service

DO NOT MERGE SMP: Check p_cb->role in smp_br_state_machine_event
authorHansong Zhang <hsz@google.com>
Wed, 30 May 2018 00:35:01 +0000 (17:35 -0700)
committerRyan Longair <rlongair@google.com>
Tue, 12 Jun 2018 18:14:33 +0000 (11:14 -0700)
Bug: 80145946
Test: manual
Change-Id: Ic83eaa4be868d5a345d80cd50a6915c0af719a53
(cherry picked from commit 078756d8071e0c122b2c75d416ebc22f77ed54e4)

stack/smp/smp_l2c.c

index d401136..bd38525 100644 (file)
@@ -29,7 +29,7 @@
 #include <string.h>
 #include "btm_ble_api.h"
 #include "l2c_api.h"
-
+#include "log/log.h"
 #include "smp_int.h"
 
 
@@ -264,6 +264,12 @@ static void smp_br_connect_callback(UINT16 channel, BD_ADDR bd_addr, BOOLEAN con
                      (bd_addr[4]<<8)+bd_addr[5],
                      (connected) ? "connected" : "disconnected");
 
+    if (p_cb->role > HCI_ROLE_SLAVE) {
+        SMP_TRACE_ERROR ("%s: invalid role %d", __func__, p_cb->role);
+        android_errorWriteLog(0x534e4554, "80145946");
+        return;
+    }
+
     if (connected)
     {
         if(!p_cb->connect_initialized)