This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] add attribute nonstring
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