1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

Merge pull request #20855 from benpicco/coap_block_finish-fix

nanocoap: always write at least 1 byte in coap_block2_finish()
This commit is contained in:
Marian Buschsieweke 2024-09-12 15:01:19 +00:00 committed by GitHub
commit 1fa7db2eda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1339,6 +1339,11 @@ bool coap_block_finish(coap_block_slicer_t *slicer, uint16_t option)
uint32_t blkopt = _slicer2blkopt(slicer, more);
size_t olen = _encode_uint(&blkopt);
/* ensure that we overwrite the dummy value set by coap_block2_init() */
if (!olen) {
olen = 1;
}
coap_put_option(slicer->opt, option - delta, option, (uint8_t *)&blkopt, olen);
return more;
}