Re: [PATCH 2.6]: IPv6: strcpy -> strlcpy
From: Ihar 'Philips' Filipau
Date: Fri Nov 28 2003 - 09:07:01 EST
Russell King wrote:
That ends up writing uninitialised kernel data to (unprivileged) user
space. So would strcpy() used in that situation.
I used to use:
char buf[MAX];
...
buf[MAX-1] = 0; /* zero terminate */
strncpy(buf, src, MAX-1);
This is safe regarding both 0 termination and 0 padding rest of string.
--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
Because the kernel depends on it existing. "init" |_|*|_|
literally _is_ special from a kernel standpoint, |_|_|*|
because its' the "reaper of zombies" (and, may I add, |*|*|*|
that would be a great name for a rock band).
-- Linus Torvalds
-
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/