system/bt
修訂 | 247c64ee940b88cb7c14c857cb8630b8f3f1a979 (tree) |
---|---|
時間 | 2019-11-23 04:12:19 |
作者 | Adam Seaton <aseaton@goog...> |
Commiter | Myles Watson |
Revert "Fix potential OOB write in btm_read_remote_ext_features_complete"
This reverts commit efcedeb60ea270cf6be228a88da4cf3bad65975c.
Reason for revert: reverting from release branches due to functional regressions in Auto.
Bug: 144205318
Change-Id: I80d7fb4f910e6c5c88668141e83ca48401151496
@@ -1084,7 +1084,7 @@ void btm_read_remote_features_complete(uint8_t* p) { | ||
1084 | 1084 | * Returns void |
1085 | 1085 | * |
1086 | 1086 | ******************************************************************************/ |
1087 | -void btm_read_remote_ext_features_complete(uint8_t* p, uint8_t evt_len) { | |
1087 | +void btm_read_remote_ext_features_complete(uint8_t* p) { | |
1088 | 1088 | tACL_CONN* p_acl_cb; |
1089 | 1089 | uint8_t page_num, max_page; |
1090 | 1090 | uint16_t handle; |
@@ -1092,14 +1092,6 @@ void btm_read_remote_ext_features_complete(uint8_t* p, uint8_t evt_len) { | ||
1092 | 1092 | |
1093 | 1093 | BTM_TRACE_DEBUG("btm_read_remote_ext_features_complete"); |
1094 | 1094 | |
1095 | - if (evt_len < HCI_EXT_FEATURES_SUCCESS_EVT_LEN) { | |
1096 | - android_errorWriteLog(0x534e4554, "141552859"); | |
1097 | - BTM_TRACE_ERROR( | |
1098 | - "btm_read_remote_ext_features_complete evt length too short. length=%d", | |
1099 | - evt_len); | |
1100 | - return; | |
1101 | - } | |
1102 | - | |
1103 | 1095 | ++p; |
1104 | 1096 | STREAM_TO_UINT16(handle, p); |
1105 | 1097 | STREAM_TO_UINT8(page_num, p); |
@@ -1119,13 +1111,6 @@ void btm_read_remote_ext_features_complete(uint8_t* p, uint8_t evt_len) { | ||
1119 | 1111 | return; |
1120 | 1112 | } |
1121 | 1113 | |
1122 | - if (page_num > max_page) { | |
1123 | - android_errorWriteLog(0x534e4554, "141552859"); | |
1124 | - BTM_TRACE_ERROR("btm_read_remote_ext_features_complete num_page=%d invalid", | |
1125 | - page_num); | |
1126 | - return; | |
1127 | - } | |
1128 | - | |
1129 | 1114 | p_acl_cb = &btm_cb.acl_db[acl_idx]; |
1130 | 1115 | |
1131 | 1116 | /* Copy the received features page */ |
@@ -119,7 +119,7 @@ extern uint16_t btm_get_acl_disc_reason_code(void); | ||
119 | 119 | extern tBTM_STATUS btm_remove_acl(const RawAddress& bd_addr, |
120 | 120 | tBT_TRANSPORT transport); |
121 | 121 | extern void btm_read_remote_features_complete(uint8_t* p); |
122 | -extern void btm_read_remote_ext_features_complete(uint8_t* p, uint8_t evt_len); | |
122 | +extern void btm_read_remote_ext_features_complete(uint8_t* p); | |
123 | 123 | extern void btm_read_remote_ext_features_failed(uint8_t status, |
124 | 124 | uint16_t handle); |
125 | 125 | extern void btm_read_remote_version_complete(uint8_t* p); |
@@ -75,8 +75,7 @@ static void btu_hcif_authentication_comp_evt(uint8_t* p); | ||
75 | 75 | static void btu_hcif_rmt_name_request_comp_evt(uint8_t* p, uint16_t evt_len); |
76 | 76 | static void btu_hcif_encryption_change_evt(uint8_t* p); |
77 | 77 | static void btu_hcif_read_rmt_features_comp_evt(uint8_t* p); |
78 | -static void btu_hcif_read_rmt_ext_features_comp_evt(uint8_t* p, | |
79 | - uint8_t evt_len); | |
78 | +static void btu_hcif_read_rmt_ext_features_comp_evt(uint8_t* p); | |
80 | 79 | static void btu_hcif_read_rmt_version_comp_evt(uint8_t* p); |
81 | 80 | static void btu_hcif_qos_setup_comp_evt(uint8_t* p); |
82 | 81 | static void btu_hcif_command_complete_evt(BT_HDR* response, void* context); |
@@ -296,7 +295,7 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, BT_HDR* p_msg) { | ||
296 | 295 | btu_hcif_read_rmt_features_comp_evt(p); |
297 | 296 | break; |
298 | 297 | case HCI_READ_RMT_EXT_FEATURES_COMP_EVT: |
299 | - btu_hcif_read_rmt_ext_features_comp_evt(p, hci_evt_len); | |
298 | + btu_hcif_read_rmt_ext_features_comp_evt(p); | |
300 | 299 | break; |
301 | 300 | case HCI_READ_RMT_VERSION_COMP_EVT: |
302 | 301 | btu_hcif_read_rmt_version_comp_evt(p); |
@@ -1212,8 +1211,7 @@ static void btu_hcif_read_rmt_features_comp_evt(uint8_t* p) { | ||
1212 | 1211 | * Returns void |
1213 | 1212 | * |
1214 | 1213 | ******************************************************************************/ |
1215 | -static void btu_hcif_read_rmt_ext_features_comp_evt(uint8_t* p, | |
1216 | - uint8_t evt_len) { | |
1214 | +static void btu_hcif_read_rmt_ext_features_comp_evt(uint8_t* p) { | |
1217 | 1215 | uint8_t* p_cur = p; |
1218 | 1216 | uint8_t status; |
1219 | 1217 | uint16_t handle; |
@@ -1221,7 +1219,7 @@ static void btu_hcif_read_rmt_ext_features_comp_evt(uint8_t* p, | ||
1221 | 1219 | STREAM_TO_UINT8(status, p_cur); |
1222 | 1220 | |
1223 | 1221 | if (status == HCI_SUCCESS) |
1224 | - btm_read_remote_ext_features_complete(p, evt_len); | |
1222 | + btm_read_remote_ext_features_complete(p); | |
1225 | 1223 | else { |
1226 | 1224 | STREAM_TO_UINT16(handle, p_cur); |
1227 | 1225 | btm_read_remote_ext_features_failed(status, handle); |
@@ -1323,8 +1323,6 @@ typedef struct { | ||
1323 | 1323 | |
1324 | 1324 | #define HCI_FEATURE_BYTES_PER_PAGE 8 |
1325 | 1325 | |
1326 | -#define HCI_EXT_FEATURES_SUCCESS_EVT_LEN 13 | |
1327 | - | |
1328 | 1326 | #define HCI_FEATURES_KNOWN(x) \ |
1329 | 1327 | (((x)[0] | (x)[1] | (x)[2] | (x)[3] | (x)[4] | (x)[5] | (x)[6] | (x)[7]) != 0) |
1330 | 1328 |