From: Dan Carpenter <redacted>
Date: Tue, 1 Apr 2014 15:35:34 +0300
I don't understand what you think the point of strlcpy() is, if it's not
to deal with source strings which aren't NUL terminated.
If strlcpy() is meant to handle non-NULL terminated strings, then it's
kernel doc needs to be adjusted.
/**
* strlcpy - Copy a %NUL terminated string into a sized buffer
* @dest: Where to copy the string to
* @src: Where to copy the string from
* @size: size of destination buffer
*
* Compatible with *BSD: the result is always a valid
* NUL-terminated string that fits in the buffer (unless,
* of course, the buffer size is zero). It does not pad
* out the result like strncpy() does.
*/
That says to me that 'src' is expected to be NULL terminated.
Furthermore, I like YOSHIFUJI Hideaki's idea that we should
actually validate the string and return -EINVAL if it is not
given to us NULL terminated.