This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new 7585a01e4 apps/bttester: copy whole mbuf chain in get_attrs
7585a01e4 is described below
commit 7585a01e43d9c24ebcf7aa5c9955122d777869d6
Author: Krzysztof Kopyściński <[email protected]>
AuthorDate: Fri Jul 28 13:04:18 2023 +0200
apps/bttester: copy whole mbuf chain in get_attrs
Whole GATT database can be big and data may be missing from rsp.
---
apps/bttester/src/btp_gatt.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/apps/bttester/src/btp_gatt.c b/apps/bttester/src/btp_gatt.c
index a9d8d7f43..c96593a3d 100644
--- a/apps/bttester/src/btp_gatt.c
+++ b/apps/bttester/src/btp_gatt.c
@@ -1750,11 +1750,17 @@ get_attrs(const void *cmd, uint16_t cmd_len,
gatt_attr->type_length = 2;
uuid_val = htole16(BLE_UUID16(entry->ha_uuid)->value);
- os_mbuf_append(buf, &uuid_val, sizeof(uuid_val));
+ if (os_mbuf_append(buf, &uuid_val, sizeof(uuid_val))) {
+ status = BTP_STATUS_FAILED;
+ goto done;
+ }
} else {
gatt_attr->type_length = 16;
- os_mbuf_append(buf, BLE_UUID128(entry->ha_uuid)->value,
- gatt_attr->type_length);
+ if (os_mbuf_append(buf, BLE_UUID128(entry->ha_uuid)->value,
+ gatt_attr->type_length)) {
+ status = BTP_STATUS_FAILED;
+ goto done;
+ }
}
count++;
@@ -1763,9 +1769,9 @@ get_attrs(const void *cmd, uint16_t cmd_len,
}
rp->attrs_count = count;
- memcpy(rp->attrs, buf->om_data, buf->om_len);
+ os_mbuf_copydata(buf, 0, os_mbuf_len(buf), rp->attrs);
- *rsp_len = sizeof(*rp) + buf->om_len;
+ *rsp_len = sizeof(*rp) + os_mbuf_len(buf);
done:
os_mbuf_free_chain(buf);