Boost logo

Boost-Build :

From: Alex Besogonov (cyberax_at_[hidden])
Date: 2006-06-05 14:42:50


goodmen wrote:
> so ,I think it must to write like this to avoid buffer overrun.
> void lol_add(
> LOL *lol,
> LIST *l )
> {
> if( lol->count < LOL_MAX-1/*Note here!!*/ )
> lol->list[ lol->count++ ] = l;
> }
> Are there anyone agree with me ?
What's wrong with this code?

lol->count++ is postincrement, so there's no chance to write out of
buffer bounds.

-- 
With respect,
            Alex Besogonov (cyberax_at_[hidden])

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk