Date: Mon, 20 Oct 2008 18:10:23 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: Xin LI <delphij@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r183989 - head/lib/libutil Message-ID: <86wsg3gscw.fsf@ds4.des.no> In-Reply-To: <200810172121.m9HLLETA098194@svn.freebsd.org> (Xin LI's message of "Fri, 17 Oct 2008 21:21:14 %2B0000 (UTC)") References: <200810172121.m9HLLETA098194@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Xin LI <delphij@FreeBSD.org> writes: > Modified: head/lib/libutil/login_times.c > ============================================================================== > --- head/lib/libutil/login_times.c Fri Oct 17 21:14:50 2008 (r183988) > +++ head/lib/libutil/login_times.c Fri Oct 17 21:21:14 2008 (r183989) > @@ -72,8 +72,7 @@ parse_lt(const char * str) > char buf[64]; > > /* Make local copy and force lowercase to simplify parsing */ > - p = strncpy(buf, str, sizeof buf); > - buf[sizeof buf - 1] = '\0'; > + p = strlcpy(buf, str, sizeof buf); > for (i = 0; buf[i]; i++) > buf[i] = (char)tolower(buf[i]); This makes absolutely no sense: strncpy() and strlcpy() have different return types. The existing code was safe and worked just fine; why break it? DES -- Dag-Erling Smørgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86wsg3gscw.fsf>
