mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(ble/bluedroid): preserve ATT error on prepare write completion
Skip prepare-write echo validation when the GATT stack reports a non-success status. ATT Error Response carries no prepare-write echo body (rsp_len=0), so the check incorrectly overwrote errors such as GATT_INSUF_AUTHENTICATION (0x05) with GATT_INVALID_PDU (0x04).
This commit is contained in:
@@ -1484,8 +1484,9 @@ void bta_gattc_write_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_OP_CMPL *p_data)
|
||||
( *p_clcb->p_rcb->p_cback)(BTA_GATTC_PREP_WRITE_EVT, (tBTA_GATTC *)&cb_data);
|
||||
return;
|
||||
}
|
||||
/* Rsp value is one ATT chunk (<= MTU-5), not necessarily full api_write.len. */
|
||||
{
|
||||
/* Rsp value is one ATT chunk (<= MTU-5), not necessarily full api_write.len.
|
||||
* Only validate echo on success; ATT Error Response has no prepare-write body. */
|
||||
if (p_data->status == BTA_GATT_OK) {
|
||||
UINT16 rsp_len = p_data->p_cmpl->att_value.len;
|
||||
UINT16 req_len = p_clcb->p_q_cmd->api_write.len;
|
||||
tGATT_VALUE *a = &p_data->p_cmpl->att_value;
|
||||
|
||||
Reference in New Issue
Block a user