PERFORCE change 99283 for review

M. Warner Losh imp at bsdimp.com
Sun Jun 18 02:38:15 UTC 2006


In message: <200606150629.k5F6T1lO099650 at repoman.freebsd.org>
            Ryan Beasley <ryanb at freebsd.org> writes:
: http://perforce.freebsd.org/chv.cgi?CH=99283
: 
: Change 99283 by ryanb at ryanb_yuki on 2006/06/15 06:28:44
: 
: 	Correct misuse of strncpy's length argument.
: 
: Affected files ...
: 
: .. //depot/projects/soc2006/rbeasley_sound/sys/dev/sound/pcm/sound.c#3 edit
: 
: Differences ...
: 
: ==== //depot/projects/soc2006/rbeasley_sound/sys/dev/sound/pcm/sound.c#3 (text+ko) ====
: 
: @@ -1140,8 +1140,8 @@
:  	static char si_product[] = "OSS/FreeBSD";
:  	static char si_version[] = "4.0.0a";
:  
: -	strncpy(si->product, si_product, sizeof(si->product));
: -	strncpy(si->version, si_version, sizeof(si->version));
: +	strncpy(si->product, si_product, sizeof(si->product) - 1);
: +	strncpy(si->version, si_version, sizeof(si->version) - 1);
:  	si->versionnum = SOUND_VERSION;
:  	si->numaudios = (pcm_devclass != NULL) ?
:  	    		devclass_get_count(pcm_devclass) :

strlcpy likely is better.

Warner


More information about the p4-projects mailing list