From 76508f4c23d55a00cd00e6d67e56d5462a367115 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 7 Nov 2023 18:09:09 +0800 Subject: [PATCH 1/2] fix(bt/bluedroid): Fix ble adv report evt type --- components/bt/host/bluedroid/stack/btm/btm_ble_gap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c index 2ce4488e38..7d76ac1630 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -3355,7 +3355,11 @@ BOOLEAN btm_ble_update_inq_result(BD_ADDR bda, tINQ_DB_ENT *p_i, UINT8 addr_type if (evt_type != BTM_BLE_SCAN_RSP_EVT) { p_cur->ble_evt_type = evt_type; } - +#if BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY + if (evt_type == BTM_BLE_SCAN_RSP_EVT) { + p_cur->ble_evt_type = evt_type; + } +#endif p_i->inq_count = p_inq->inq_counter; /* Mark entry for current inquiry */ if (p_le_inq_cb->adv_len != 0) { From a607ea496b7b7fcac45e7f239287998c17ca5a5a Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Tue, 7 Nov 2023 19:41:11 +0800 Subject: [PATCH 2/2] fix(bt/bluedroid): Fix ble keysize check --- components/bt/host/bluedroid/api/esp_gap_ble_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index 3e41a58903..4688e49ba2 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -576,7 +576,11 @@ esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type, LOG_ERROR("ESP_BLE_APP_ENC_KEY_SIZE is deprecated, use ESP_GATT_PERM_ENCRYPT_KEY_SIZE in characteristic definition"); return ESP_ERR_NOT_SUPPORTED; } - + if (param_type == ESP_BLE_SM_MAX_KEY_SIZE || param_type == ESP_BLE_SM_MIN_KEY_SIZE) { + if (((uint8_t *)value)[0] > 16 || ((uint8_t *)value)[0] < 7) { + return ESP_ERR_INVALID_ARG; + } + } btc_msg_t msg = {0}; btc_ble_gap_args_t arg;