urlmon/umon.c: Fix corrution

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sun May 22 12:06:01 CDT 2005


Changelog:
	wine/dlls/urlmon/umon.c:URLMonikerImpl_BindToStorage()
	Don't use a HeapAllocated pointer for other purposes
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/urlmon/umon.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/umon.c,v
retrieving revision 1.52
diff -u -r1.52 umon.c
--- wine/dlls/urlmon/umon.c	5 May 2005 09:50:46 -0000	1.52
+++ wine/dlls/urlmon/umon.c	22 May 2005 11:00:54 -0000
@@ -467,7 +467,7 @@
             if(SUCCEEDED(hres)) {
                 WCHAR *urlcopy, *tmpwc;
                 URL_COMPONENTSW url;
-                WCHAR *host, *path, *user, *pass;
+                WCHAR *host, *path, *path1, *user, *pass;
                 DWORD lensz = sizeof(This->expected_size);
                 DWORD dwService = 0;
                 BOOL bSuccess;
@@ -666,9 +666,9 @@
                     break;
 
                 case INTERNET_SCHEME_FILE:
-                    path = This->URLName + 5; /* Skip the "file:" part */
-                    if ((path[0] != '/' && path[0] != '\\') ||
-                        (path[1] != '/' && path[1] != '\\'))
+                    path1 = This->URLName + 5; /* Skip the "file:" part */
+                    if ((path1[0] != '/' && path1[0] != '\\') ||
+                        (path1[1] != '/' && path1[1] != '\\'))
                     {
                         hres = E_FAIL;
                     }
@@ -676,10 +676,10 @@
                     {
                         HANDLE h;
 
-                        path += 2;
-                        if (path[0] == '/' || path[0] == '\\')
-                            ++path;
-                        h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
+                        path1 += 2;
+                        if (path1[0] == '/' || path1[0] == '\\')
+                            ++path1;
+                        h = CreateFileW(path1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
                         if (h == (HANDLE) HFILE_ERROR)
                         {
                             hres = HRESULT_FROM_WIN32(GetLastError());
@@ -712,7 +712,8 @@
                     HeapFree(GetProcessHeap(), 0, user);
                 if (pass)
                     HeapFree(GetProcessHeap(), 0, pass);
-                HeapFree(GetProcessHeap(), 0, path);
+                if (path)
+		    HeapFree(GetProcessHeap(), 0, path);
                 HeapFree(GetProcessHeap(), 0, host);
                 HeapFree(GetProcessHeap(), 0, urlcopy);
             }



More information about the wine-patches mailing list