Sebastian Lackner : shlwapi: Fix invalid usage of CompareString in PathCreateFromUrlW.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Nov 18 10:25:19 CST 2014
Module: wine
Branch: master
Commit: 132164423905c495785bd64f74867712c5fcec97
URL: http://source.winehq.org/git/wine.git/?a=commit;h=132164423905c495785bd64f74867712c5fcec97
Author: Sebastian Lackner <sebastian at fds-team.de>
Date: Tue Nov 18 07:11:39 2014 +0100
shlwapi: Fix invalid usage of CompareString in PathCreateFromUrlW.
---
dlls/shlwapi/path.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index 5c7a88a..a3b462c 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -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;
More information about the wine-cvs
mailing list