Commit 0d86a8d6 authored by Yasumasa Suenaga's avatar Yasumasa Suenaga Committed by Wei Liu
Browse files

tools/hv: fcopy: Fix incorrect file path conversion



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: 82b0945c ("tools: hv: Add new fcopy application based on uio driver")
Signed-off-by: default avatarYasumasa Suenaga <yasuenag@gmail.com>
Reviewed-by: default avatarNaman Jain <namjain@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250628022217.1514-2-yasuenag@gmail.com


Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
Message-ID: <20250628022217.1514-2-yasuenag@gmail.com>
parent 7b89a44b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment