[PATCH] Fix InternetCrackUrlA

Brian Gerst <[email protected]> Thu, 31 Mar 2005 12:58:07 -0500
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
If there is no path component to the URL, then lpszUrlPath is not 
getting set to NULL.  This causes crashes when tracing wininet because 
of unterminated strings.  Also removes two FIXMEs that work around this bug.

--
				Brian Gerst
crackurl.diff (text/plain, 1.7 KB)
Index: cookie.c
===================================================================
RCS file: /cvsroot/winex/dlls/wininet/cookie.c,v
retrieving revision 1.9
diff -u -p -r1.9 cookie.c
--- cookie.c	18 Feb 2004 22:27:45 -0000	1.9
+++ cookie.c	31 Mar 2005 17:48:39 -0000
@@ -209,9 +209,6 @@ cookie_domain *COOKIE_addDomainFromUrl(L
     TRACE("Url cracked. Domain: %s, Path: %s.\n", debugstr_a(UrlComponents.lpszHostName),
 	  debugstr_a(UrlComponents.lpszUrlPath));
 
-    /* hack for now - FIXME - There seems to be a bug in InternetCrackUrl?? */
-    UrlComponents.lpszUrlPath = NULL;
-
     return COOKIE_addDomain(UrlComponents.lpszHostName, UrlComponents.lpszUrlPath);
 }
 
@@ -290,9 +287,6 @@ cookie_domain *COOKIE_findNextDomainFrom
     TRACE("Url cracked. Domain: %s, Path: %s.\n", debugstr_a(UrlComponents.lpszHostName),
 	  debugstr_a(UrlComponents.lpszUrlPath));
 
-    /* hack for now - FIXME - There seems to be a bug in InternetCrackUrl?? */
-    UrlComponents.lpszUrlPath = NULL;
-
     return COOKIE_findNextDomain(UrlComponents.lpszHostName, UrlComponents.lpszUrlPath,
 				 previous_domain, allow_partial);
 }
Index: internet.c
===================================================================
RCS file: /cvsroot/winex/dlls/wininet/internet.c,v
retrieving revision 1.14
diff -u -p -r1.14 internet.c
--- internet.c	15 Nov 2004 15:41:20 -0000	1.14
+++ internet.c	31 Mar 2005 17:48:41 -0000
@@ -1092,7 +1092,9 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lps
     }
     else
     {
-        lpUrlComponents->dwUrlPathLength = 0;
+        if (!SetUrlComponentValue(&lpUrlComponents->lpszUrlPath,
+				  &lpUrlComponents->dwUrlPathLength, NULL, 0))
+         return FALSE;
     }
 
     TRACE("%s: host(%s) path(%s) extra(%s)\n", lpszUrl, lpUrlComponents->lpszHostName,