Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a3ff4be
fix(ble/bluedroid): Fixed BLE incorrect device record count issue
esp-zhp Nov 21, 2025
131322d
fix(ble/bluedroid): Fixed missing BLE connect and disconnect events
esp-zhp Nov 21, 2025
62edb3f
chor(mcpwm): replace p4 psram test
suda-morris Nov 24, 2025
674514e
feat(openthread): optimize fail cases in CI test
Nov 21, 2025
e3f03bb
fix(ble/bluedroid): Fix potential CVE-2020-0022 in reassemble_and_di…
esp-zhp Nov 27, 2025
1d22e44
fix(ble/bluedroid): Fix potential CVE-2024-0039 out-of-bounds write i…
esp-zhp Nov 27, 2025
316c5a5
fix(ble/bluedroid): Fix potential out-of-bounds issue
esp-zhp Nov 27, 2025
0f9c93d
fix(openthread): fix a potential stack overflow in TREL
gytxxsy Nov 21, 2025
71c8c34
fix(nimble): Add change to cancel sync in case of reattempt
rahult-github Dec 2, 2025
9112b87
fix(ble/bluedroid): Add bounds check in ble_ancs example
esp-zhp Dec 3, 2025
7ca7eb4
fix(ble/bluedroid): Use snprintf in ble_eddystone example
esp-zhp Dec 3, 2025
45835b0
fix(ble/bluedroid): Use calloc in gatt_server example
esp-zhp Dec 3, 2025
dedf21c
fix(ble/bluedroid): Fix memory leak in ble_spp_server example
esp-zhp Dec 3, 2025
f67bb6c
fix(ble/blufi): Add DH param length validation
esp-zhp Dec 3, 2025
775b647
fix(ble/bt): Add NULL check in esp_hid_host example
esp-zhp Dec 3, 2025
de2b4af
fix(ble/bt): Add NULL check in esp_hid_device example
esp-zhp Dec 3, 2025
8ef83c2
fix(ble/bluedroid): Add NULL check in esp_ble_gap_add_device_to_resol…
esp-zhp Dec 3, 2025
8960e3e
fix(ble/bluedroid): Add NULL checks in esp_gap_ble_api
esp-zhp Dec 3, 2025
1ab91f0
fix(ble/bluedroid): Add NULL checks in GATT APIs
esp-zhp Dec 3, 2025
8739a2d
fix(ble/bluedroid): Fix VLA in a2dp_gatts_coex example
esp-zhp Dec 3, 2025
1936ba8
fix(ble/bluedroid): Add boundary check for adv_handle in btm_ble_adv_…
esp-zhp Dec 3, 2025
569854b
fix(ble/bluedroid): Add length check in prepare write response
esp-zhp Dec 3, 2025
7c7f30a
fix(ble/bluedroid): Fix security issues in GAP module
esp-zhp Dec 3, 2025
ef96110
fix(ble/bluedroid): Fix security issues in HCI module
esp-zhp Dec 3, 2025
d28b874
fix(ble/bluedroid): Fix security issues in GATT module
esp-zhp Dec 3, 2025
5af377c
fix(openthread): resolve deadlock issues due to switching_lock
tanyanquan Dec 4, 2025
74b2941
fix(openthread): fix an error in Kconfig
gytxxsy Nov 28, 2025
26e2372
feat(openthread): Use PSRAM by default for OpenThread message buffers…
gytxxsy Nov 19, 2025
acc569f
fix(802.15.4): fixed energy detection result
zwx1995esp Nov 11, 2025
8a70704
fix(openthread): open nvs from the configured partition
zwx1995esp Dec 4, 2025
332c73b
Merge branch 'fix/fix_an_ot_trel_risk_v5.5' into 'release/v5.5'
Dec 11, 2025
0f07ad1
fix: add mutex protection for software trigger RegDMA start to avoid …
Dec 4, 2025
0e541d8
feat(parlio): support parlio gdma eof on p4 rev3.0
Kainarx Nov 21, 2025
11c8f6a
fix(mbedtls/aes): Reallocate buffers only if in external RAM
Harshal5 Dec 10, 2025
b81023c
bugfix(wifi): Resolve the memory corruption issue in FTM
Dec 12, 2025
2b9938d
Merge branch 'bugfix/update_thread_ci_testcases_v5.5' into 'release/v…
Dec 12, 2025
b66a069
Merge branch 'bugfix/ftm_memory_corruption_v5.5' into 'release/v5.5'
Dec 15, 2025
9bb7aa8
Merge branch 'feat/mbedtls_aes_tests_v5.5' into 'release/v5.5'
AdityaHPatwardhan Dec 15, 2025
5452adb
fix(ble/bluedroid): Fixed reconnection failed with extend adv
Weijian-Espressif Dec 15, 2025
e3d0b19
Merge branch 'bugfix/fix_regdma_data_race_v5.5' into 'release/v5.5'
Dec 15, 2025
3aa928d
fix(coex): fix esp32 coex crash issue (7260f71)
Espressif-liuuuu Dec 16, 2025
9ab736c
fix(spi_flash): limit CPU clock to 160MHz for encrypted flash writes
mahavirj Nov 3, 2025
faf6cc4
feat(spi_flash): implement dynamic CPU frequency switching workaround…
ginkgm Nov 25, 2025
187f43a
Revert "fix(esp_system): limit CPU clock to 160MHz in ESP32-C5 for fl…
ginkgm Nov 25, 2025
27f1484
test(esp_flash): fixed test config that c5 not support 120MHz
ginkgm Dec 17, 2025
ebd08a5
fix(bt): Update bt lib for ESP32-C3 and ESP32-S3(5106725)
esp-cjh Dec 17, 2025
c4cc875
fix(ble/bledroid): fix codespell issues in bluedroid code
esp-zhp Dec 17, 2025
c8ba727
fix(phy): fix esp32s2 phy lib issue
Dec 17, 2025
0f4b384
Merge branch 'bugfix/esp32c5_encrypted_flash_write_v5.5' into 'releas…
ginkgm Dec 18, 2025
2a039e3
Merge branch 'bugfix/fix_bt_4205_v5.5' into 'release/v5.5'
Dec 18, 2025
f230471
Merge branch 'bugfix/fix_esp32_coex_cache_disable_crash_v5.5' into 'r…
Dec 18, 2025
51493f9
Merge branch 'bugfix/fix_reattempt_sync_estab_v5.5' into 'release/v5.5'
Isl2017 Dec 18, 2025
5cf7ec6
Merge branch 'bugfix/fix_ble_security_issue_2025_v5.5' into 'release/…
Isl2017 Dec 18, 2025
a63ae74
Merge branch 'bugfix/fix_reconnect_failed_with_extend_adv_v5.5' into …
Isl2017 Dec 18, 2025
8789584
Merge branch 'bugfix/bug_ble_max_device_record_v5.5' into 'release/v5.5'
Isl2017 Dec 18, 2025
e0577ae
Merge branch 'fix/fix_esp32s2_phy_issue_v55' into 'release/v5.5'
Dec 18, 2025
3678a25
fix(gdma): fix set dma burst size failure on p4 v3.0
Kainarx Dec 22, 2025
094518f
fix(check_placements): update method names to follow PEP 8 conventions
suda-morris Dec 23, 2025
cff4ebe
Merge branch 'feat/support_parlio_gdma_eof_on_p4eco5_v5.5' into 'rele…
suda-morris Dec 23, 2025
dc3df80
Merge branch 'fix/set_dma_incr_fail_on_p4eco5_v5.5' into 'release/v5.5'
suda-morris Dec 23, 2025
5d5d15f
fix(esp_hw_support): fix RNG to LP Peri domain dependency on C5
esp-wzh Dec 23, 2025
08f5f0d
fix(esp_system): limit CPU clock to 160MHz in ESP32-C5 for flash encr…
ginkgm Dec 23, 2025
0f1ab31
fix(wifi): fixed the crash issue when send espnow data in HE phymode
zhangyanjiaoesp Dec 24, 2025
ce76ba3
Merge branch 'fix/mcpwm_p4eco_psram_test_v5.5' into 'release/v5.5'
suda-morris Dec 24, 2025
a81c787
Merge branch 'bugfix/fix_crash_issue_when_send_espnow_data_in_he_phym…
Dec 24, 2025
af96540
Merge branch 'fix/fix_c5_rng_to_lp_peri_dependency_v5.5' into 'releas…
suda-morris Dec 24, 2025
e81ca4b
Merge branch 'bugfix/c5_add_freq_restriction_again_v5.5' into 'releas…
Dec 24, 2025
30aaf64
change(version): Update version to 5.5.2
suda-morris Dec 24, 2025
366dadf
Merge branch 'update/version_5_5_2' into 'release/v5.5'
suda-morris Dec 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab/ci/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ variables:
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
# we're using .cache folder for caches
GIT_CLEAN_FLAGS: -ffdx -e .cache/
LATEST_GIT_TAG: v5.5.1
LATEST_GIT_TAG: v5.5.2

SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
# by default we will fetch all submodules
Expand Down
73 changes: 64 additions & 9 deletions components/bt/host/bluedroid/api/esp_gap_ble_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ esp_err_t esp_ble_gap_start_advertising(esp_ble_adv_params_t *adv_params)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (adv_params == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_START_ADV;
Expand Down Expand Up @@ -171,6 +175,10 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (remote_device == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN;
Expand All @@ -182,6 +190,9 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_

esp_err_t esp_ble_gap_addr_create_static(esp_bd_addr_t rand_addr)
{
if (rand_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}
// Static device address: First two bits are '11', rest is random
rand_addr[0] = 0xC0 | (esp_random() & 0x3F);
for (int i = 1; i < 6; i++) {
Expand All @@ -192,6 +203,9 @@ esp_err_t esp_ble_gap_addr_create_static(esp_bd_addr_t rand_addr)

esp_err_t esp_ble_gap_addr_create_nrpa(esp_bd_addr_t rand_addr)
{
if (rand_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}
// Non-resolvable private address: First two bits are '00', rest is random
rand_addr[0] = (esp_random() & 0x3F);
for (int i = 1; i < 6; i++) {
Expand All @@ -207,6 +221,10 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (rand_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_SET_RAND_ADDRESS;
Expand Down Expand Up @@ -239,7 +257,7 @@ esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (addr_type > BLE_ADDR_TYPE_RANDOM ||!peer_addr || (addr_type && ((peer_addr[0] & 0xC0) != 0xC0))) {
if (addr_type > BLE_ADDR_TYPE_RANDOM || !peer_addr || !peer_irk || (addr_type && ((peer_addr[0] & 0xC0) != 0xC0))) {
return ESP_ERR_INVALID_ARG;
}

Expand Down Expand Up @@ -357,6 +375,10 @@ esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
return ESP_ERR_INVALID_STATE;
}

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

if (ESP_BLE_IS_VALID_PARAM(min_conn_int, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
ESP_BLE_IS_VALID_PARAM(max_conn_int, ESP_BLE_CONN_INT_MIN, ESP_BLE_CONN_INT_MAX) &&
ESP_BLE_IS_VALID_PARAM(supervision_tout, ESP_BLE_CONN_SUP_TOUT_MIN, ESP_BLE_CONN_SUP_TOUT_MAX) &&
Expand Down Expand Up @@ -424,6 +446,9 @@ esp_err_t esp_ble_gap_get_local_used_addr(esp_bd_addr_t local_used_addr, uint8_t
LOG_ERROR("%s, bluedroid status error", __func__);
return ESP_FAIL;
}
if (local_used_addr == NULL || addr_type == NULL) {
return ESP_ERR_INVALID_ARG;
}
if(!BTM_BleGetCurrentAddress(local_used_addr, addr_type)) {
return ESP_FAIL;
}
Expand All @@ -436,13 +461,6 @@ uint8_t *esp_ble_resolve_adv_data_by_type( uint8_t *adv_data, uint16_t adv_data_
return NULL;
}

if (((type < ESP_BLE_AD_TYPE_FLAG) || (type > ESP_BLE_AD_TYPE_128SERVICE_DATA)) &&
(type != ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE)) {
LOG_ERROR("The advertising data type is not defined, type = %x", type);
*length = 0;
return NULL;
}

if (adv_data_len == 0) {
*length = 0;
return NULL;
Expand Down Expand Up @@ -495,6 +513,10 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr)
return ESP_ERR_INVALID_STATE;
}

if (remote_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_READ_RSSI;
Expand Down Expand Up @@ -645,6 +667,10 @@ esp_err_t esp_ble_set_encryption(esp_bd_addr_t bd_addr, esp_ble_sec_act_t sec_ac

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_ENCRYPTION_EVT;
Expand All @@ -662,6 +688,10 @@ esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SECURITY_RSP_EVT;
Expand All @@ -680,6 +710,10 @@ esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t pas

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_PASSKEY_REPLY_EVT;
Expand All @@ -698,6 +732,10 @@ esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_CONFIRM_REPLY_EVT;
Expand All @@ -712,6 +750,11 @@ esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr)
{
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;

if (bd_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_REMOVE_BOND_DEV_EVT;
Expand Down Expand Up @@ -757,6 +800,10 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len)
return ESP_ERR_INVALID_ARG;
}

if (bd_addr == NULL || TK == NULL) {
return ESP_ERR_INVALID_ARG;
}

btc_msg_t msg = {0};
btc_ble_gap_args_t arg;

Expand All @@ -775,7 +822,7 @@ esp_err_t esp_ble_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t *TK, uint8_t len)

esp_err_t esp_ble_sc_oob_req_reply(esp_bd_addr_t bd_addr, uint8_t p_c[16], uint8_t p_r[16])
{
if (!p_c || !p_r) {
if (!bd_addr || !p_c || !p_r) {
return ESP_ERR_INVALID_ARG;
}

Expand Down Expand Up @@ -836,6 +883,10 @@ esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (remote_device == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_DISCONNECT_EVT;
Expand Down Expand Up @@ -864,6 +915,10 @@ esp_err_t esp_gap_ble_set_channels(esp_gap_ble_channels channels)
return ESP_ERR_INVALID_STATE;
}

if (channels == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_AFH_CHANNELS;
Expand Down
36 changes: 36 additions & 0 deletions components/bt/host/bluedroid/api/esp_gattc_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ esp_err_t esp_ble_gattc_enh_open(esp_gatt_if_t gattc_if, esp_ble_gatt_creat_conn
#if (BLE_42_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
if (remote_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN);
creat_conn_params.remote_addr_type = remote_addr_type;
Expand All @@ -187,6 +191,10 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, e
#if (BLE_50_FEATURE_SUPPORT == TRUE)
esp_err_t esp_ble_gattc_aux_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
if (remote_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

esp_ble_gatt_creat_conn_params_t creat_conn_params = {0};
memcpy(creat_conn_params.remote_bda, remote_bda, ESP_BD_ADDR_LEN);
creat_conn_params.remote_addr_type = remote_addr_type;
Expand Down Expand Up @@ -521,6 +529,10 @@ esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (read_multi == NULL) {
return ESP_ERR_INVALID_ARG;
}

tGATT_TCB *p_tcb = gatt_get_tcb_by_idx(conn_id);
if (!gatt_check_connection_state_by_tcb(p_tcb)) {
LOG_WARN("%s, The connection not created.", __func__);
Expand Down Expand Up @@ -557,6 +569,10 @@ esp_err_t esp_ble_gattc_read_multiple_variable(esp_gatt_if_t gattc_if,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (read_multi == NULL) {
return ESP_ERR_INVALID_ARG;
}

tGATT_TCB *p_tcb = gatt_get_tcb_by_idx(conn_id);
if (!gatt_check_connection_state_by_tcb(p_tcb)) {
LOG_WARN("%s, The connection not created.", __func__);
Expand Down Expand Up @@ -810,6 +826,10 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (server_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

if (handle == 0) {
return ESP_GATT_INVALID_HANDLE;
}
Expand All @@ -832,6 +852,10 @@ esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (server_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

if (handle == 0) {
return ESP_GATT_INVALID_HANDLE;
}
Expand All @@ -852,6 +876,10 @@ esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (remote_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_REFRESH;
Expand All @@ -867,6 +895,10 @@ esp_err_t esp_ble_gattc_cache_clean(esp_bd_addr_t remote_bda)

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (remote_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_CLEAN;
Expand All @@ -882,6 +914,10 @@ esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_ad

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (src_addr == NULL || assoc_addr == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_ASSOC;
Expand Down
26 changes: 25 additions & 1 deletion components/bt/host/bluedroid/api/esp_gatts_api.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -78,6 +78,10 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatts_if,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (service_id == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTS;
msg.act = BTC_GATTS_ACT_CREATE_SERVICE;
Expand All @@ -98,6 +102,10 @@ esp_err_t esp_ble_gatts_create_attr_tab(const esp_gatts_attr_db_t *gatts_attr_db

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (gatts_attr_db == NULL) {
return ESP_ERR_INVALID_ARG;
}

if (max_nb_attr > ESP_GATT_ATTR_HANDLE_MAX) {
LOG_ERROR("The number of attribute should not be greater than CONFIG_BT_GATT_MAX_SR_ATTRIBUTES\n");
return ESP_ERR_INVALID_ARG;
Expand Down Expand Up @@ -143,6 +151,10 @@ esp_err_t esp_ble_gatts_add_char(uint16_t service_handle, esp_bt_uuid_t *char_

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (char_uuid == NULL) {
return ESP_ERR_INVALID_ARG;
}

/* parameter validation check */
status = esp_ble_gatts_add_char_desc_param_check(char_val, control);
if (status != ESP_OK){
Expand Down Expand Up @@ -183,6 +195,10 @@ esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle,

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (descr_uuid == NULL) {
return ESP_ERR_INVALID_ARG;
}

/* parameter validation check */
status = esp_ble_gatts_add_char_desc_param_check(char_descr_val, control);
if (status != ESP_OK){
Expand Down Expand Up @@ -344,6 +360,10 @@ esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *l
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (length == NULL || value == NULL) {
return ESP_GATT_INVALID_PDU;
}

if (attr_handle == ESP_GATT_ILLEGAL_HANDLE) {
*length = 0;
return ESP_GATT_INVALID_HANDLE;
Expand All @@ -359,6 +379,10 @@ esp_err_t esp_ble_gatts_open(esp_gatt_if_t gatts_if, esp_bd_addr_t remote_bda, b

ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

if (remote_bda == NULL) {
return ESP_ERR_INVALID_ARG;
}

msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTS;
msg.act = BTC_GATTS_ACT_OPEN;
Expand Down
Loading