https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e29609147b6da48f4a0166b39be8664a996b06b8

commit e29609147b6da48f4a0166b39be8664a996b06b8
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sat Sep 22 23:37:43 2018 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Sep 23 00:16:06 2018 +0200

    [SHELL32] In _SHGetUserShellFolderPath(), check the return value of 
_SHExpandEnvironmentStrings()
    and bail out if it failed. That way we won't use and cache in the registry 
an invalid-expanded string.
    
    CORE-14981
---
 dll/win32/shell32/wine/shellpath.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dll/win32/shell32/wine/shellpath.c 
b/dll/win32/shell32/wine/shellpath.c
index 6396641a15..96e47b288a 100644
--- a/dll/win32/shell32/wine/shellpath.c
+++ b/dll/win32/shell32/wine/shellpath.c
@@ -1480,7 +1480,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, 
HANDLE hToken, LPCWSTR us
 #ifndef __REACTOS__
             _SHExpandEnvironmentStrings(path, szTemp);
 #else
-            _SHExpandEnvironmentStrings(hToken, path, szTemp, 
_countof(szTemp));
+            hr = _SHExpandEnvironmentStrings(hToken, path, szTemp, 
_countof(szTemp));
+            if (FAILED(hr))
+                goto end;
 #endif
             lstrcpynW(path, szTemp, MAX_PATH);
         }
@@ -1493,6 +1495,9 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, 
HANDLE hToken, LPCWSTR us
     }
     else
         hr = E_FAIL;
+#ifdef __REACTOS__
+end:
+#endif
     RegCloseKey(shellFolderKey);
     RegCloseKey(userShellFolderKey);
     TRACE("returning 0x%08x\n", hr);

Reply via email to