Re: [PATCH] isdnloop: NUL-terminate strings from userspace

From: Vegard Nossum
Date: Fri Mar 07 2014 - 06:42:25 EST


On 03/07/2014 12:26 PM, Dan Carpenter wrote:
On Fri, Mar 07, 2014 at 11:56:04AM +0100, Vegard Nossum wrote:
Both the in-kernel and BSD strlcpy() require that the source string is
NUL terminated.

No. You're obviously wrong. What on earth?

Well, from lib/string.c:

size_t strlcpy(char *dest, const char *src, size_t size)
{
size_t ret = strlen(src);

The BSD man page:

"Also note that strlcpy() and strlcat() only operate on true ``C'' strings. This means that for strlcpy() src must be NUL-terminated and for strlcat() both src and dst must be NUL-terminated."


Vegard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/