Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 2008 21:29:05 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r183990 - head/lib/libc/string
Message-ID:  <200810172129.m9HLT5BT098365@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri Oct 17 21:29:05 2008
New Revision: 183990
URL: http://svn.freebsd.org/changeset/base/183990

Log:
  Use strlcpy() in !localized case to avoid the -1's.

Modified:
  head/lib/libc/string/strxfrm.c

Modified: head/lib/libc/string/strxfrm.c
==============================================================================
--- head/lib/libc/string/strxfrm.c	Fri Oct 17 21:21:14 2008	(r183989)
+++ head/lib/libc/string/strxfrm.c	Fri Oct 17 21:29:05 2008	(r183990)
@@ -51,8 +51,7 @@ strxfrm(char * __restrict dest, const ch
 			if (slen < len)
 				strcpy(dest, src);
 			else {
-				strncpy(dest, src, len - 1);
-				dest[len - 1] = '\0';
+				strlcpy(dest, src, len);
 			}
 		}
 		return slen;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810172129.m9HLT5BT098365>