[riot-notifications] [RIOT-OS/RIOT] netdev: iolist not checked for empty elements on send (#11163)

Gunar Schorcht 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
```c
void *memcpy(void *_dst, const void *_src, size_t len)
{
    unsigned char *dst = _dst;
    const unsigned char *src = _src;
    while(len-- > 0)
        *dst++ = *src++;
    return _dst;
}
```
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:
https://github.com/RIOT-OS/RIOT/issues/11163#issuecomment-472581596
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190313/bbe89c70/attachment.html>


More information about the notifications mailing list