1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gcoap: fix swap-out of option length for ETag

This commit is contained in:
Martine Lenders 2022-08-18 14:38:37 +02:00
parent 9bc0454d99
commit 1135cc0f7e
No known key found for this signature in database
GPG Key ID: 2134D77A5336DD80

View File

@ -1334,7 +1334,7 @@ static ssize_t _cache_check(const uint8_t *buf, size_t len,
uint8_t *start = coap_find_option(&req, COAP_OPT_ETAG);
/* option length must always be <= COAP_ETAG_LENGTH_MAX = 8 < 12, so the length
* is encoded in the first byte, see also RFC 7252, section 3.1 */
*start &= 0x0f;
*start &= 0xf0;
/* first if around here should make sure we are <= 8 < 0xf, so we don't need to
* bitmask resp_etag_len */
*start |= (uint8_t)resp_etag_len;