Rebase against c579a81a6353dd7c843270561cd5763ff895de40.

This commit is contained in:
Sebastian Lackner
2017-08-30 01:14:43 +02:00
parent 7b687557c3
commit d076d04ebc
10 changed files with 23 additions and 255 deletions

View File

@@ -1,27 +1,28 @@
From d43c0229efb42913a0902ee42817e3a928598587 Mon Sep 17 00:00:00 2001
From 0546ec6c4084213cb3ffa4c635d5392305d86726 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Sun, 17 Apr 2016 20:06:46 +0800
Subject: kernel32: GetShortPathName should fail when called with a wildcard.
This patch fixes heap corruption reported in the bug 39355.
---
dlls/kernel32/path.c | 10 +++++++++-
dlls/kernel32/path.c | 11 ++++++++++-
dlls/kernel32/tests/path.c | 2 --
2 files changed, 9 insertions(+), 3 deletions(-)
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index a906acc..ecebab2 100644
index a3897431717..9cd0b57a65b 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -43,6 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
@@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
#define MAX_PATHNAME_LEN 1024
static int path_safe_mode = -1; /* path mode set by SetSearchPathMode */
+static const WCHAR wildcardsW[] = {'*','?',0};
+
/* check if a file name is for an executable file (.exe or .com) */
static inline BOOL is_executable( const WCHAR *name )
@@ -455,7 +456,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
{
@@ -445,7 +447,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
WIN32_FIND_DATAW wfd;
HANDLE goit;
@@ -30,7 +31,7 @@ index a906acc..ecebab2 100644
if (!longpath)
{
@@ -484,6 +485,13 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
@@ -474,6 +476,13 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
sp = lp = 4;
}
@@ -45,10 +46,10 @@ index a906acc..ecebab2 100644
if (longpath[lp] != '/' && longpath[lp + 1] == ':' )
{
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c
index 0dc8802..3934046 100644
index 31a90b4f532..707fb88bab9 100644
--- a/dlls/kernel32/tests/path.c
+++ b/dlls/kernel32/tests/path.c
@@ -1461,9 +1461,7 @@ static void test_GetShortPathNameW(void)
@@ -1477,9 +1477,7 @@ static void test_GetShortPathNameW(void)
lstrcpyW(ptr, wildW);
SetLastError(0xdeadbeef);
length = GetShortPathNameW( path, short_path, sizeof(short_path)/sizeof(*short_path) );
@@ -59,5 +60,5 @@ index 0dc8802..3934046 100644
lstrcpyW(ptr, a_bcdeW);
--
2.7.1
2.14.1