Alexandre Julliard : shell32: Avoid infinite loop in _SHExpandEnvironmentStrings.
Alexandre Julliard
julliard at winehq.org
Thu Sep 6 15:51:51 CDT 2018
Module: wine
Branch: master
Commit: ceea5bda14ecf4c8ce262fc7ab88df49e500bc38
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ceea5bda14ecf4c8ce262fc7ab88df49e500bc38
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Sep 6 12:59:45 2018 +0200
shell32: Avoid infinite loop in _SHExpandEnvironmentStrings.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/shellpath.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index afd6340..dccfbba 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3855,22 +3855,15 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
}
else
{
- DWORD ret = ExpandEnvironmentStringsW(szSrc, szDest, MAX_PATH);
+ DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
if (ret > MAX_PATH)
hr = E_NOT_SUFFICIENT_BUFFER;
else if (ret == 0)
hr = HRESULT_FROM_WIN32(GetLastError());
- else
- hr = S_OK;
- }
- if (SUCCEEDED(hr) && szDest[0] == '%')
- strcpyW(szTemp, szDest);
- else
- {
- /* terminate loop */
- szTemp[0] = '\0';
+ else if (!strcmpW( szTemp, szDest )) break; /* nothing expanded */
}
+ if (SUCCEEDED(hr)) strcpyW(szTemp, szDest);
}
end:
if (key)
More information about the wine-cvs
mailing list