From a974bbc0a78f69c75275a2730194b8ff93d601d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kopy=C5=9Bci=C5=84ski?= Date: Wed, 7 Jun 2023 08:19:19 +0200 Subject: [PATCH] apps: bttester: fix attribute reporting in read by UUID There is no need to call `gatt_buf_add` when `gatt_buf` if filled using pointer `chr` from `gatt_buf_reserve`. This caused sending malformed data to BTP reposnse event. --- apps/bttester/src/gatt_cl.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/bttester/src/gatt_cl.c b/apps/bttester/src/gatt_cl.c index 3ca5ecfc0..af0876429 100644 --- a/apps/bttester/src/gatt_cl.c +++ b/apps/bttester/src/gatt_cl.c @@ -844,7 +844,8 @@ read_uuid_cb(uint16_t conn_handle, rp->data_length = gatt_buf.len; rp->value_length = attr_len; rp->status = 0; - os_mbuf_append(buf, gatt_buf.buf + 1, gatt_buf.len - 1); + os_mbuf_append(buf, gatt_buf.buf, gatt_buf.len); + tester_send_buf(BTP_SERVICE_ID_GATTC, opcode, CONTROLLER_INDEX, buf); read_destroy(); @@ -855,12 +856,6 @@ read_uuid_cb(uint16_t conn_handle, attr_len = attr->om->om_len; } - if (gatt_buf_add(attr->om->om_data, attr->om->om_len) == NULL) { - read_destroy(); - rc = BLE_HS_ENOMEM; - goto free; - } - chr = gatt_buf_reserve(sizeof(*chr) + attr->om->om_len); if (!chr) { read_destroy();