[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061210214934.GC47959@gaz.sfgoth.com>
Date: Sun, 10 Dec 2006 13:49:34 -0800
From: Mitchell Blank Jr <mitch@...oth.com>
To: Willy Tarreau <w@....eu>
Cc: Folkert van Heusden <folkert@...heusden.com>,
linux-kernel@...r.kernel.org
Subject: Re: strncpy optimalisation? (lib/string.c)
Willy Tarreau wrote:
> Original code completely pads the destination with zeroes,
> while yours only adds the last zero. Your code does what
> strncpy() is said to do, but maybe there's a particular
> reason for it to behave differently in the kernel
No, the kernel's strncpy() behaves the same as the one in libc. Run
"man strncpy" if you don't believe me.
In the common case where you just want to copy a string and avoid
overflow use strlcpy() instead
-Mitch
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists