Re: [PATCH v5 1/1] tools/hv: fcopy: Fix incorrect file path conversion

Wei Liu
2025-07-09T23:02:46Z

On Tue, Jul 01, 2025 at 03:06:08PM +0530, Naman Jain wrote:
>
>
> On 6/28/2025 7:52 AM, yasuenag@gmail.com wrote:
> > From: Yasumasa Suenaga <yasuenag@gmail.com>
> >
> > The hv_fcopy_uio_daemon fails to correctly handle file copy requests
> > from Windows hosts (e.g. via Copy-VMFile) due to wchar_t size
> > differences between Windows and Linux. On Linux, wchar_t is 32 bit,
> > whereas Windows uses 16 bit wide characters.
> >
> > Fix this by ensuring that file transfers from host to Linux guest
> > succeed with correctly decoded file names and paths.
> >
> > - Treats file name and path as __u16 arrays, not wchar_t*.
> > - Allocates fixed-size buffers (W_MAX_PATH) for converted strings
> > instead of using malloc.
> > - Adds a check for target path length to prevent snprintf() buffer
> > overflow.
> >
> > Fixes: 82b0945ce2c2 ("tools: hv: Add new fcopy application based on uio driver")
> > Signed-off-by: Yasumasa Suenaga <yasuenag@gmail.com>
[...]
> Reviewed-by: Naman Jain <namjain@linux.microsoft.com>

Applied to hyperv-fixes. Thank you both for the patch and the review!