About the strnlen() function size_t strnlen(const char *s, size_t maxlen);
in the strnlen description from https://pubs.opengroup.org/onlinepubs/9799919799/functions/strnlen.html "The strnlen() function shall never examine more than maxlen bytes of the array pointed to by s." So, when maxlen is 0, the strnlen() function shall not examine any byte. Does this imply that in this case, s may be a null pointer? Note: The description does not explicitly say that s needs to be an array in all cases (just like in the free() case, where a null pointer is allowed though its description first says "The free() function shall cause the space pointed to by ptr to be deallocated" unconditionally). If this is valid, this would make the glibc incorrect as it uses __nonnull in the strnlen declaration. Otherwise, a null pointer should explicitly be disallowed. -- Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
