• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


Commit MetaInfo

修訂856262c9237db2c48b4a84871b17087b2dd1f2ec (tree)
時間2019-12-20 06:22:18
作者Myles Watson <mylesgw@goog...>
CommiterMyles Watson

Log Message

HCI: Check length of connection complete event

Fixes: 141619686
Test: Pair and connect
Change-Id: Ib15d6a8cbb8c6a7404bf1afa023277429029867d
(cherry picked from commit 7ee6458cf4939ad78dbebd70c2520ad56c31f4a9)

Change Summary

差異

--- a/stack/btu/btu_hcif.cc
+++ b/stack/btu/btu_hcif.cc
@@ -68,7 +68,7 @@ static void btu_hcif_inquiry_result_evt(uint8_t* p);
6868 static void btu_hcif_inquiry_rssi_result_evt(uint8_t* p);
6969 static void btu_hcif_extended_inquiry_result_evt(uint8_t* p);
7070
71-static void btu_hcif_connection_comp_evt(uint8_t* p);
71+static void btu_hcif_connection_comp_evt(uint8_t* p, uint8_t evt_len);
7272 static void btu_hcif_connection_request_evt(uint8_t* p);
7373 static void btu_hcif_disconnection_comp_evt(uint8_t* p);
7474 static void btu_hcif_authentication_comp_evt(uint8_t* p);
@@ -272,7 +272,7 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, BT_HDR* p_msg) {
272272 btu_hcif_extended_inquiry_result_evt(p);
273273 break;
274274 case HCI_CONNECTION_COMP_EVT:
275- btu_hcif_connection_comp_evt(p);
275+ btu_hcif_connection_comp_evt(p, hci_evt_len);
276276 break;
277277 case HCI_CONNECTION_REQUEST_EVT:
278278 btu_hcif_connection_request_evt(p);
@@ -990,7 +990,7 @@ static void btu_hcif_extended_inquiry_result_evt(uint8_t* p) {
990990 * Returns void
991991 *
992992 ******************************************************************************/
993-static void btu_hcif_connection_comp_evt(uint8_t* p) {
993+static void btu_hcif_connection_comp_evt(uint8_t* p, uint8_t evt_len) {
994994 uint8_t status;
995995 uint16_t handle;
996996 RawAddress bda;
@@ -998,6 +998,12 @@ static void btu_hcif_connection_comp_evt(uint8_t* p) {
998998 uint8_t enc_mode;
999999 tBTM_ESCO_DATA esco_data;
10001000
1001+ if (evt_len < 11) {
1002+ android_errorWriteLog(0x534e4554, "141619686");
1003+ HCI_TRACE_WARNING("%s: malformed event of size %hhd", __func__, evt_len);
1004+ return;
1005+ }
1006+
10011007 STREAM_TO_UINT8(status, p);
10021008 STREAM_TO_UINT16(handle, p);
10031009 STREAM_TO_BDADDR(bda, p);