Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ble_gatts_clt_cfg_access(...) odd return values casted from BLE_HS_E... to BLE_ATT_ERR_... on storage overflow #1729

Open
therealergo opened this issue Mar 15, 2024 · 0 comments
Assignees

Comments

@therealergo
Copy link

When the number of CCCD's exceeds BLE_STORE_MAX_CCCDS, ble_store_delete_cccd(...) and ble_store_write_cccd(...) will return error codes from the BLE_HS_E... range, such as BLE_HS_ENOENT, BLE_HS_ENOMEM, and BLE_HS_ENOTSUP (dependent on the code in store_status_cb).

When an attempt is made to write to the descriptor, these error codes are then directly returned from ble_gatts_clt_cfg_access(...). This causes them to be returned by the stack as the corresponding unrelated attribute errors. This causes strange unexpected attribute access errors such as BLE_ATT_ERR_INSUFFICIENT_AUTHEN, BLE_ATT_ERR_REQ_NOT_SUPPORTED, and BLE_ATT_ERR_INSUFFICIENT_AUTHOR when an overflow occurs.

These unexpected errors can cause some strange follow-up behavior: For example, returning BLE_ATT_ERR_INSUFFICIENT_AUTHEN when connected to an iOS device causes that iOS device to re-attempt pairing, regardless of whether the current connection is already bonded and encrypted.

ble_gatts_clt_cfg_access(...) should probably check for a non-zero return code and return e.g. BLE_ATT_ERR_INSUFFICIENT_RES in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants