shlwapi: Fix invalid usage of CompareString in PathCreateFromUrlW.

This commit is contained in:
Sebastian Lackner 2014-11-18 07:11:39 +01:00 committed by Alexandre Julliard
parent e2c0694901
commit 1321644239
1 changed files with 5 additions and 3 deletions

View File

@ -3313,6 +3313,9 @@ HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath,
if (!pszUrl || !pszPath || !pcchPath || !*pcchPath)
return E_INVALIDARG;
if (lstrlenW(pszUrl) < 5)
return E_INVALIDARG;
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5,
file_colon, 5) != CSTR_EQUAL)
return E_INVALIDARG;
@ -3354,9 +3357,8 @@ HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath,
src -= 1;
break;
case 2:
if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, src, 9,
localhost, 9) == CSTR_EQUAL &&
(src[9] == '/' || src[9] == '\\'))
if (lstrlenW(src) >= 10 && CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE,
src, 9, localhost, 9) == CSTR_EQUAL && (src[9] == '/' || src[9] == '\\'))
{
/* 'file://localhost/' + escaped DOS path */
src += 10;