This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] vfprintf: validate nargs and maybe allocate from heap


On 02/06/2012 09:20 AM, Kees Cook wrote:
>>             specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
> This on in particular I've looked at and have mostly convinced myself that
> it is okay, since it must constantly copy the previous memory into the
> newly allocated region.

The copying is safe; it's the allocation calculation
that might not be safe.  Couldn't it be that
nspecs_size > SIZE_MAX / 2, so that 2 * nspecs_size overflows?
We must also make sure the previous expression
nspecs * sizeof (*specs) doesn't overflow.
That sort of thing.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]