mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From 07791ffe43d1fda2618994f98986ab5e9cbf3c97 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
Date: Sat, 6 Feb 2016 18:31:25 +0100
|
|
Subject: kernel32: Strip invalid characters from mask in FindFirstFileExW.
|
|
|
|
---
|
|
dlls/kernel32/file.c | 20 ++++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
|
|
index b6dba6a..3297f4b 100644
|
|
--- a/dlls/kernel32/file.c
|
|
+++ b/dlls/kernel32/file.c
|
|
@@ -2009,12 +2009,32 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
|
|
}
|
|
else
|
|
{
|
|
+ static const WCHAR invalidW[] = { '<', '>', '\"', 0 };
|
|
+ static const WCHAR wildcardW[] = { '*', 0 };
|
|
+ DWORD mask_len;
|
|
+
|
|
if (!RtlCreateUnicodeString( &info->mask, mask ))
|
|
{
|
|
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
|
goto error;
|
|
}
|
|
|
|
+ /* strip invalid characters from mask */
|
|
+ mask_len = info->mask.Length / sizeof(WCHAR);
|
|
+ while (mask_len && strchrW(invalidW, mask[mask_len - 1]))
|
|
+ mask_len--;
|
|
+
|
|
+ if (!mask_len)
|
|
+ {
|
|
+ strcpyW( info->mask.Buffer, wildcardW );
|
|
+ info->mask.Length = strlenW(wildcardW) * sizeof(WCHAR);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ info->mask.Buffer[mask_len] = 0;
|
|
+ info->mask.Length = mask_len * sizeof(WCHAR);
|
|
+ }
|
|
+
|
|
/* truncate dir name before mask */
|
|
*mask = 0;
|
|
nt_name.Length = (mask - nt_name.Buffer) * sizeof(WCHAR);
|
|
--
|
|
2.7.0
|
|
|