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 ?



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