OSDN Git Service

DO NOT MERGE: BTA_HH_LE: Check nullptr
authorHansong Zhang <hsz@google.com>
Wed, 10 Feb 2021 21:10:01 +0000 (13:10 -0800)
committerMyles Watson <mylesgw@google.com>
Thu, 6 May 2021 22:30:29 +0000 (22:30 +0000)
Bug: 179162240
Change-Id: Id1ef400a596d7a22492b30e36c4dd7f96054cab7
Tag: #security
Test: manual
Merged-In: Id1ef400a596d7a22492b30e36c4dd7f96054cab7

bta/hh/bta_hh_le.cc

index 83c5e4b..22ddf10 100644 (file)
@@ -1780,6 +1780,9 @@ static void write_report_cb(uint16_t conn_id, tGATT_STATUS status,
 
   const gatt::Characteristic* p_char =
       BTA_GATTC_GetCharacteristic(conn_id, handle);
+
+  if (p_char == nullptr) return;
+
   uint16_t uuid = p_char->uuid.As16Bit();
   if (uuid != GATT_UUID_HID_REPORT && uuid != GATT_UUID_HID_BT_KB_INPUT &&
       uuid != GATT_UUID_HID_BT_MOUSE_INPUT &&