svn commit: r183989 - head/lib/libutil

Dag-Erling Smørgrav des at des.no
Mon Oct 20 16:10:25 UTC 2008


Xin LI <delphij at 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 at des.no


More information about the svn-src-all mailing list