Skip to content

Commit 31701fa

Browse files
authored
Merge pull request #13449 from paul-szczepanek-arm/fix-prep-write
BLE: Fix writing attributes larger than MTU size
2 parents c355d8d + 6aa89ae commit 31701fa

File tree

4 files changed

+1229
-1210
lines changed

4 files changed

+1229
-1210
lines changed

connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/include/ble/internal/PalAttClientImpl.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,11 @@ class PalAttClient : public interface::PalAttClient {
381381
struct PrepareWriteResponseConverter : ResponseConverter<ATTC_PREPARE_WRITE_RSP> {
382382
static AttPrepareWriteResponse convert(const attEvt_t* event)
383383
{
384-
// WARNING: Not sure if correct, the stack erase the length parameter
385384
return AttPrepareWriteResponse(
386385
event->handle,
387-
to_uint16_t(event->pValue + 2),
388-
// FIXME: the stack set the lenght to 0, the data won't be seen ...
386+
0, /* offset is lost */
389387
make_const_Span(
390-
event->pValue + 4,
388+
event->pValue,
391389
event->valueLen
392390
)
393391
);

connectivity/FEATURE_BLE/libraries/TARGET_CORDIO/stack/ble-host/sources/stack/att/atts_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void attsProcPrepWriteReq(attsCcb_t *pCcb, uint16_t len, uint8_t *pPacket)
260260
}
261261
/* verify write length, fixed length */
262262
else if (((pAttr->settings & ATTS_SET_VARIABLE_LEN) == 0) &&
263-
(writeLen != pAttr->maxLen))
263+
(writeLen > pAttr->maxLen))
264264
{
265265
err = ATT_ERR_LENGTH;
266266
}

0 commit comments

Comments
 (0)