Skip to content

Commit 2e2523e

Browse files
sjanccvinayak
authored andcommitted
[nrf fromtree] tests: bluetooth: tester: Fix GATT read multiple
Pass only speficied number of handler to read_params for GATT read multiple. This is to avoid sending invalid (zeros) handles in ATT_READ_MULTIPLE_REQ. This was affecting GATT/CL/GAR/BI-18-C and GATT/CL/GAR/BI-19-C qualification test cases. Signed-off-by: Szymon Janc <[email protected]> (cherry picked from commit 4f57614)
1 parent 7ac4181 commit 2e2523e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/bluetooth/tester/src/btp_gatt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,11 +1651,11 @@ static uint8_t read_multiple(const void *cmd, uint16_t cmd_len,
16511651
return BTP_STATUS_FAILED;
16521652
}
16531653

1654-
if (cp->handles_count > ARRAY_SIZE(handles)) {
1654+
if (cp->handles_count == 0 || cp->handles_count > ARRAY_SIZE(handles)) {
16551655
return BTP_STATUS_FAILED;
16561656
}
16571657

1658-
for (i = 0; i < ARRAY_SIZE(handles); i++) {
1658+
for (i = 0; i < cp->handles_count; i++) {
16591659
handles[i] = sys_le16_to_cpu(cp->handles[i]);
16601660
}
16611661

@@ -1670,7 +1670,7 @@ static uint8_t read_multiple(const void *cmd, uint16_t cmd_len,
16701670
}
16711671

16721672
read_params.func = read_cb;
1673-
read_params.handle_count = i;
1673+
read_params.handle_count = cp->handles_count;
16741674
read_params.multiple.handles = handles; /* not used in read func */
16751675
read_params.multiple.variable = false;
16761676
read_params.chan_opt = BT_ATT_CHAN_OPT_NONE;

0 commit comments

Comments
 (0)