mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-05 21:04:49 +00:00
nimble/host: Validate advertising instance before parsing event
Advertising instance is used for indexing slave state array. Since instance is provided by host invalid handle in event means there is bug in controller.
This commit is contained in:
@@ -971,6 +971,13 @@ ble_hs_hci_evt_le_adv_set_terminated(uint8_t subevent, const void *data,
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
/* this indicates bug in controller as host uses instances from
|
||||
* 0-BLE_ADV_INSTANCES range only
|
||||
*/
|
||||
if (ev->adv_handle >= BLE_ADV_INSTANCES) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
if (ev->status == 0) {
|
||||
/* ignore return code as we need to terminate advertising set anyway */
|
||||
ble_gap_rx_conn_complete(&pend_conn_complete, ev->adv_handle);
|
||||
@@ -992,6 +999,13 @@ ble_hs_hci_evt_le_scan_req_rcvd(uint8_t subevent, const void *data,
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
/* this indicates bug in controller as host uses instances from
|
||||
* 0-BLE_ADV_INSTANCES range only
|
||||
*/
|
||||
if (ev->adv_handle >= BLE_ADV_INSTANCES) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
ble_gap_rx_scan_req_rcvd(ev);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user