lkml.org 
[lkml]   [2003]   [Nov]   [28]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 28 Nov 2003 15:04:51 +0100
From"Ihar 'Philips' Filipau" <>
SubjectRe: [PATCH 2.6]: IPv6: strcpy -> strlcpy
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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2008