qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V6 1/5] block/qemu-img: Refine and export infini


From: Jeff Cody
Subject: Re: [Qemu-devel] [PATCH V6 1/5] block/qemu-img: Refine and export infinite loop checking in collect_image_info_list()
Date: Fri, 8 Nov 2013 09:46:27 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Nov 08, 2013 at 06:53:27AM -0700, Eric Blake wrote:
> On 11/08/2013 03:19 AM, Fam Zheng wrote:
> > 
> >> +    BlockDriverState *bs;
> >> +    BlockDriver *drv;
> >> +    char fbuf[1024];
> > 
> > Could use PATH_MAX.
> 
> PATH_MAX is undefined on some platforms, and could also be defined to
> something larger than a page which could lead to nastiness if you end up
> overflowing the stack.  I personally prefer malloc'd buffers rather than
> attempting to guess at how large to size things, although the rest of
> the code base also has similar caps at 1024 so this isn't making it worse.
>

A quick grep through the code shows ~57 arrays allocated using 1024,
and ~63 allocated using PATH_MAX.  Clearly not all of the 1024
allocation cases are pathname related, but certainly some of them are.

Maybe it makes sense to have a QEMU_PATH_MAX defined to 1024 in qemu,
so at least we are consistent everywhere.  (To clarify for Xu, I am
not talking about this patch series at all, just in general).

-Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]