shlwapi: Avoid reading past the pointer in PathCreateFromUrlW (valgrind)

Bruno Jesus 00cpxxx at gmail.com
Thu May 29 21:57:51 CDT 2014


The previous loop in the file [1] may have reached the end of the
string, so avoid reading past the pointer in the test. It happens for
test [2]

Partially fix for bug https://bugs.winehq.org/show_bug.cgi?id=36573

[1] https://source.winehq.org/source/dlls/shlwapi/path.c#L3375
[2] https://source.winehq.org/source/dlls/shlwapi/tests/path.c#L78
-------------- next part --------------
diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index 080c243..01e3ae7 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -3377,7 +3377,7 @@ HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath,
             len = src - pszUrl;
             StrCpyNW(dst, pszUrl, len + 1);
             dst += len;
-            if (isalphaW(src[1]) && (src[2] == ':' || src[2] == '|'))
+            if (*src && isalphaW(src[1]) && (src[2] == ':' || src[2] == '|'))
             {
                 /* 'Forget' to add a trailing '/', just like Windows */
                 src++;


More information about the wine-patches mailing list