> Problem is, the strings are (possibly) still not zero-terminated:
> strncpy() only appends zeroes if src contents are short enough; if they
> are not, dest is only zero-terminated if dest[sizeof(dest)-1] was zero
> before.
> strlcpy() semantics promise more sanity; dest is always zero-terminated
> (if its size is >= 1), and the size parameter holds total dest size.
> (See lib/string.c for more details.)
In all cases there is a memset() which sets the entire structure to
zero. Since we never write to the last byte with the strncpy() it will
be null terminated. But if you think strlcpy() is safer for the future,
i can make you a third patch.
Greetings, Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]