[PATCH] add attribute nonstring

Joseph Myers joseph@codesourcery.com
Tue Nov 14 18:27:00 GMT 2017


On Tue, 14 Nov 2017, Florian Weimer wrote:

> However, the original patch should really use strnlen or memchr, and not
> strlen.  As posted, the strlen is either invalid because the array is not
> NUL-terminated, or it passes because the string is short enough.

if_nametoindex takes a char * argument.  POSIX doesn't say explicitly, but 
I'd presume that must be a NUL-terminated string, with undefined behavior 
otherwise.  That's separate from what the kernel interface is.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list