Date: Thu, 24 Jan 2002 14:48:17 -0700 From: "Todd C. Miller" <Todd.Miller@courtesan.com> To: "Andrew R. Reiter" <arr@FreeBSD.ORG> Cc: "Andrey A. Chernov" <ache@nagual.pp.ru>, Alexey Zelkin <alexey.zelkin@ionidea.com>, audit@FreeBSD.ORG Subject: Re: CFR: strncpy -> strlcpy in setlocale() Message-ID: <200201242148.g0OLmHJi006634@xerxes.courtesan.com> In-Reply-To: Your message of "Thu, 24 Jan 2002 16:42:30 EST." <Pine.NEB.3.96L.1020124164054.61343C-100000@fledge.watson.org> References: <Pine.NEB.3.96L.1020124164054.61343C-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.NEB.3.96L.1020124164054.61343C-100000@fledge.watson.org> so spake "Andrew R. Reiter" (arr): > I know strlcpy() makes more sense than strncpy(), but is there any > difference in terms of speed? This being said, if strlcpy() is slower and > the strncpy() usage is correct, is there really a need for a change? I > guess readability and possible future mistakes in usage are a bonus for > strlcpy. strlcpy() is generally faster since strncpy() does NUL fill and so will also write "len" bytes even when the source string is much smaller. - todd To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201242148.g0OLmHJi006634>