tech-userlevel archive

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

Re: Changing fgetstr/fgetln to use getdelim

On Sun, 20 Sep 2009 16:51:05 +0100
Roy Marples <> wrote:

> One thing I did notice though is that __slbexpand expands the buffer on 
> upto a size_t, but the place holder on the struct is only an int and 
> doesn't have any bounds checking. Surely this is a potential overflow?

I didn't check the whole file (only the diff), but it appears that the
old expand code added more bytes than requested, possibly in attempt
not to realloc(3) too often.  A common practice is to simply double the
buffer for better performance, although this might be overkill.


Home | Main Index | Thread Index | Old Index