Skip to content

Commit 919aa17

Browse files
MariuszSkamranashif
authored andcommitted
Bluetooth: gatt: Fix infinite read_by_uuid procedure
The attribute handle used to read next attribute has to be incremented to not loop reading the same attribute. Signed-off-by: Mariusz Skamra <[email protected]>
1 parent 0f01fe7 commit 919aa17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

subsys/bluetooth/host/gatt.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,6 +2415,14 @@ static void parse_read_by_uuid(struct bt_conn *conn,
24152415
if (rsp->len > length) {
24162416
break;
24172417
}
2418+
2419+
/* Stop if it's the last handle to be read */
2420+
if (params->by_uuid.start_handle == params->by_uuid.end_handle) {
2421+
params->func(conn, 0, params, NULL, 0);
2422+
return;
2423+
}
2424+
2425+
params->by_uuid.start_handle++;
24182426
}
24192427

24202428
/* Continue reading the attributes */

0 commit comments

Comments
 (0)