NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/50867: src/usr.sbin/grfconfig/grfconfig.c:165: array index used before sanity check ?



The following reply was made to PR bin/50867; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
	dcb314%hotmail.com@localhost
Cc: 
Subject: Re: bin/50867: src/usr.sbin/grfconfig/grfconfig.c:165: array index used before sanity check ?
Date: Mon, 29 Feb 2016 15:56:05 -0500

 On Feb 29,  8:55pm, kre%munnari.OZ.AU@localhost (Robert Elz) wrote:
 -- Subject: Re: bin/50867: src/usr.sbin/grfconfig/grfconfig.c:165: array inde
 
 |  
 |  I know Christos has already "fixed" this one, but there is absolutely nothing
 |  wrong with the code that was there (shown above).
 |  
 |  The first time through the loop, i is 0, which is certainly within
 |  bounds, every other time through the loop, the "i < 30" test has
 |  just been performed (from the last time through), and i has only been
 |  incremented once, so we now know i <= 31 - which is much less than
 |  sizeof buf.
 |  
 |  This one did not need fixing, the analysis tool does.
 
 I know, but the code is easier to understand now (at least I hope it is).
 
 christos
 


Home | Main Index | Thread Index | Old Index