[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.
--
Fam
- [Qemu-devel] [PATCH V2 0/5] Add infinite loop check for backing file chain, Xu Wang, 2013/07/08
- [Qemu-devel] [PATCH V2 3/5] Check infinite loop in bdrv_img_create(), Xu Wang, 2013/07/08
- [Qemu-devel] [PATCH V2 4/5] Add backing file loop check in change_backing_file(), Xu Wang, 2013/07/08
- [Qemu-devel] [PATCH V2 5/5] Add infinite loop check in drive_init(), Xu Wang, 2013/07/08
- Re: [Qemu-devel] [PATCH V2 0/5] Add infinite loop check for backing file chain, Fam Zheng, 2013/07/10