[riot-notifications] [RIOT-OS/RIOT] netdev: iolist not checked for empty elements on send (#11163)
notifications at github.com
Wed Mar 13 20:58:14 CET 2019
Hm, my guess was also that `memcpy` called with a size of 0 does nothing.
Event though memcpy is probabely implemented in a way like
void *memcpy(void *_dst, const void *_src, size_t len)
unsigned char *dst = _dst;
const unsigned char *src = _src;
while(len-- > 0)
*dst++ = *src++;
the C99 standard says in clause _7.21.1 String handling <string.h>_ sentence (2):
"Where an argument declared as `size_t n` specifies the length of the array for a function, `n` can have the value zero on a call to that function. **Unless explicitly stated** otherwise in the description of a particular function in this subclause, **pointer arguments on such a call shall still have valid values**, as described in 7.1.4. On such a call, ..., and a function that copies characters copies zero characters."
For `memcpy` there is no explicit statement :worried: so that the pointer should be valid. The question is whether `iol->iol_base` is valid or simply `NULL`.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications