-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description of defect
In the line of code below, you are calculating the offset using the max block size of the MBED DEVICE, which is WRONG and out of spec (https://tools.ietf.org/html/rfc7959#page-29)
You need to calculate the offset using THE BLOCK SIZE SENT IN THE PACKET.
| memcpy(stored_blockwise_payload_ptr->payload_ptr + (block_number * handle->sn_coap_block_data_size), payload_ptr, payload_len); |
block_number * handle->sn_coap_block_data_size is wrong. handle->sn_coap_block_data_size is the max blockwise size of the device, NOT the block size of the packet you're currently processing
You need to pass the block_size into this function as contained in the incoming back. (You derive this value already on line 1925 of the same file) ( uint16_t block_size = 1u << (block_temp + 4);)
Target(s) affected by this defect ?
All targets
Toolchain(s) (name and version) displaying this defect ?
All toolchains, but I'm using IAR
What version of Mbed-os are you using (tag or sha) ?
master (0548981)
#0548981
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
How is this defect reproduced ?
Send a blockwise PUT using a smaller blockwise size than is set in SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE