From c79c6c437f50511dbf43790141720a7b271a87df Mon Sep 17 00:00:00 2001 From: Zhang Hai Peng Date: Wed, 26 Aug 2026 14:43:46 +0800 Subject: [PATCH] fix(ble/bluedroid): restore find info PDU stop on UUID format mismatch Restore GATT_NO_RESOURCES when sequential attributes have differing UUID sizes so gatts_process_find_info() stops building the response PDU. (cherry picked from commit 196cb395452108b4084e8fee868efaee7eac4b0e) Co-authored-by: zhanghaipeng --- components/bt/host/bluedroid/stack/gatt/gatt_sr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/bt/host/bluedroid/stack/gatt/gatt_sr.c b/components/bt/host/bluedroid/stack/gatt/gatt_sr.c index 8bc641438a6..a2061c05a04 100644 --- a/components/bt/host/bluedroid/stack/gatt/gatt_sr.c +++ b/components/bt/host/bluedroid/stack/gatt/gatt_sr.c @@ -1041,7 +1041,7 @@ static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_ ** buffer. ** ** Returns TRUE: if data filled successfully. -** FALSE: packet full. +** FALSE: packet full, or format mismatch. ** *******************************************************************************/ static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, UINT16 *p_len, @@ -1084,8 +1084,10 @@ static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, gatt_convert_uuid32_to_uuid128(p, ((tGATT_ATTR32 *) p_attr)->uuid); p += LEN_UUID_128; } else { - // UUID format mismatch in sequential attributes - // A new request will be sent with the starting handle of the next attribute + /* UUID format mismatch in sequential attributes: end this PDU so the + * client sends a new ATT_FIND_INFORMATION_REQ from the next handle. + * GATT_NO_RESOURCES is internal flow control (not an ATT error). */ + status = GATT_NO_RESOURCES; break; } p_msg->len += info_pair_len[p_msg->offset - 1];