Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions nimble/host/src/ble_att_svr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,10 +1641,9 @@ ble_att_svr_build_read_mult_rsp(uint16_t conn_handle, uint16_t cid,
}

/* Iterate through requested handles, reading the corresponding attribute
* for each. Stop when there are no more handles to process, or the
* response is full.
* for each. Stop when there are no more handles to process.
*/
while (OS_MBUF_PKTLEN(*rxom) >= 2 && OS_MBUF_PKTLEN(txom) < mtu) {
while (OS_MBUF_PKTLEN(*rxom) >= 2) {
/* Ensure the full 16-bit handle is contiguous at the start of the
* mbuf.
*/
Expand All @@ -1667,9 +1666,19 @@ ble_att_svr_build_read_mult_rsp(uint16_t conn_handle, uint16_t cid,
}
}

/* Concatenated values should not exceed ATT_MTU - 1 octets */
if (OS_MBUF_PKTLEN(txom) > mtu) {
os_mbuf_adj(txom, mtu - OS_MBUF_PKTLEN(txom));
}

rc = 0;

done:
if (rc != 0 && txom != NULL) {
os_mbuf_free_chain(txom);
txom = NULL;
}

*out_txom = txom;
return rc;
}
Expand Down
Loading