[Top][All Lists]

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

Re: [Qemu-devel] [PATCH V2 2/5] Add WIN32 platform support for backing_f

From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH V2 2/5] Add WIN32 platform support for backing_file_loop_check()
Date: Mon, 15 Jul 2013 14:30:21 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, 07/15 14:09, Xu Wang wrote:
> 2013/7/10 Fam Zheng <address@hidden>
> > On Mon, 07/08 03:26, Xu Wang wrote:
> > > +        error_report("get file %s stat error.", path);
> > > +        return -1;
> > > +    }
> > > +    if (GetFullPathName(path, MAX_PATH_LEN, pbuf, &p) != 0) {
> > How big is MAX_PATH_LEN?
> > MSDN: If the buffer is too small to contain the path, the return value
> > is the size, in TCHARs, of the buffer that is required to hold the path
> > and the terminating null character. Please try to handle this case. (And
> > is pbuf NULL terminated in this case?)
> >
> This is really a hard desicion to set value of it because length of path on
> Windows
> could be unlimited. So here I just set an value and want to get some tips
> from others.
> Now it's set as 8192 but I missed it when I made this patch.

Yes, if you use heap allocated buffer, you can work with longer
filename. If you use fixed length buffer, ideally you should detect
whether return value is greater than your buffer size: in this case the
pbuf content is invalid (or incomplete), so your hash computation below
is inaccurate, consequentially false alarm.


reply via email to

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