mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #11176 from bergzand/pr/nrf802154/undef_memcpy
nrf802154: don't call memcpy if iolist->iol_len==0
This commit is contained in:
commit
253cf0f9fc
@ -274,8 +274,12 @@ static int _send(netdev_t *dev, const iolist_t *iolist)
|
||||
mutex_unlock(&_txlock);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
memcpy(&txbuf[len + 1], iolist->iol_base, iolist->iol_len);
|
||||
len += iolist->iol_len;
|
||||
/* Check if there is data to copy, prevents undefined behaviour with
|
||||
* memcpy when iolist->iol_base == NULL */
|
||||
if (iolist->iol_len) {
|
||||
memcpy(&txbuf[len + 1], iolist->iol_base, iolist->iol_len);
|
||||
len += iolist->iol_len;
|
||||
}
|
||||
}
|
||||
|
||||
/* specify the length of the package. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user