linux/tools/hv
Yasumasa Suenaga ef3bee8d1d tools/hv: fcopy: Fix incorrect file path conversion
[ Upstream commit 0d86a8d65c ]

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: 82b0945ce2 ("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>
Link: https://lore.kernel.org/r/20250628022217.1514-2-yasuenag@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20250628022217.1514-2-yasuenag@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-08-01 09:48:40 +01:00
..
Build tools: hv: Add new fcopy application based on uio driver 2024-04-11 14:55:53 +02:00
hv_fcopy_uio_daemon.c tools/hv: fcopy: Fix incorrect file path conversion 2025-08-01 09:48:40 +01:00
hv_get_dhcp_info.sh tools: hv: fix typos in toolchain 2019-08-17 15:29:28 -04:00
hv_get_dns_info.sh Tools: hv: Add an example script to retrieve DNS entries 2012-09-04 15:59:27 -07:00
hv_kvp_daemon.c hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for keyfile format 2024-04-10 21:25:40 +00:00
hv_set_ifconfig.sh tools: hv: change permissions of NetworkManager configuration file 2024-12-27 14:02:01 +01:00
hv_vss_daemon.c Tools: hv: Reopen the devices if read() or write() returns errors 2020-01-26 22:10:10 -05:00
lsvmbus tools: hv: lsvmbus: change shebang to use python3 2024-08-03 00:01:55 +00:00
Makefile tools: hv: rm .*.cmd when make clean 2024-09-05 07:23:08 +00:00
vmbus_bufring.c tools: hv: Add vmbus_bufring 2024-04-11 14:55:53 +02:00
vmbus_bufring.h tools: hv: Add vmbus_bufring 2024-04-11 14:55:53 +02:00
vmbus_testing vmbus_testing: fix wrong python syntax for integer value comparison 2023-07-23 23:19:30 +00:00