Commit ceea5bda authored by Alexandre Julliard's avatar Alexandre Julliard

shell32: Avoid infinite loop in _SHExpandEnvironmentStrings.

parent 54530bc4
...@@ -3855,22 +3855,15 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) ...@@ -3855,22 +3855,15 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
} }
else else
{ {
DWORD ret = ExpandEnvironmentStringsW(szSrc, szDest, MAX_PATH); DWORD ret = ExpandEnvironmentStringsW(szTemp, szDest, MAX_PATH);
if (ret > MAX_PATH) if (ret > MAX_PATH)
hr = E_NOT_SUFFICIENT_BUFFER; hr = E_NOT_SUFFICIENT_BUFFER;
else if (ret == 0) else if (ret == 0)
hr = HRESULT_FROM_WIN32(GetLastError()); hr = HRESULT_FROM_WIN32(GetLastError());
else else if (!strcmpW( szTemp, szDest )) break; /* nothing expanded */
hr = S_OK;
}
if (SUCCEEDED(hr) && szDest[0] == '%')
strcpyW(szTemp, szDest);
else
{
/* terminate loop */
szTemp[0] = '\0';
} }
if (SUCCEEDED(hr)) strcpyW(szTemp, szDest);
} }
end: end:
if (key) if (key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment