mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #11958 from miri64/emcute/fix/length-calculation
emcute: fix length field calculation
This commit is contained in:
commit
aab312e8df
@ -63,7 +63,9 @@ static volatile int result;
|
|||||||
|
|
||||||
static size_t set_len(uint8_t *buf, size_t len)
|
static size_t set_len(uint8_t *buf, size_t len)
|
||||||
{
|
{
|
||||||
if (len < (0xff - 7)) {
|
/* - `len` field minimum length == 1
|
||||||
|
* - `((len + 1) <= 0xff) == len < 0xff` */
|
||||||
|
if (len < 0xff) {
|
||||||
buf[0] = len + 1;
|
buf[0] = len + 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user