Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jun 2006 20:35:23 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        ryanb@freebsd.org
Cc:        perforce@freebsd.org
Subject:   Re: PERFORCE change 99283 for review
Message-ID:  <20060617.203523.353410589.imp@bsdimp.com>
In-Reply-To: <200606150629.k5F6T1lO099650@repoman.freebsd.org>
References:  <200606150629.k5F6T1lO099650@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200606150629.k5F6T1lO099650@repoman.freebsd.org>
            Ryan Beasley <ryanb@freebsd.org> writes:
: http://perforce.freebsd.org/chv.cgi?CH=99283
: 
: Change 99283 by ryanb@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



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