From c8e2802391b060a5ff7fe7b0f9db08fa186ad1c6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 13 Sep 2021 17:47:48 +0200 Subject: [PATCH] comdlg32: Fix path validation of UNC paths in the file dialog. Signed-off-by: Alexandre Julliard --- dlls/comdlg32/filedlg.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 0ada09aad96..0f74c85fcd8 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -2454,11 +2454,16 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf, LPWSTR p; lstrcpyW(lpwstrTemp, lpszTemp); - p = PathFindNextComponentW(lpwstrTemp); - - if (!p) break; /* end of path */ - - *p = 0; + if (lpszTemp == lpstrPathAndFile && (p = PathSkipRootW(lpwstrTemp))) + { + *p = 0; + } + else + { + p = PathFindNextComponentW(lpwstrTemp); + if (!p) break; /* end of path */ + *p = 0; + } lpszTemp = lpszTemp + lstrlenW(lpwstrTemp); /* There are no wildcards when OFN_NOVALIDATE is set */