Re: [Qemu-devel] [PATCH v2 03/12] VMDK: probe for monolithicFlat images

2011-06-24 Thread Stefan Hajnoczi
On Fri, Jun 24, 2011 at 9:18 AM, wrote: > +        const char *p = (const char *)buf; > +        const char *end = p + buf_size; > +        int version = 0; > +        while (*p && p < end) { These short-circuit comparisions need to be the other way around. If p >= end then p is out-of-range an

[Qemu-devel] [PATCH v2 03/12] VMDK: probe for monolithicFlat images

2011-06-24 Thread famcool
From: Fam Zheng Probe as the same behavior as VMware does. Recognize image as monolithicFlat descriptor file when the file is text and the first effective line (not '#' leaded comment or space line) is either 'version=1' or 'version=2'. No space or upper case charactors accepted. Signed-off-by: