PATCH: 2117, 2120

Marcus Meissner marcus at jet.franken.de
Mon Mar 22 14:58:45 CST 2004


Hi,

More bugs found by walter weiss. Bugs 2117 and 2120.

I replaced some magic constants by strlen(constant string).

Ciao, Marcus

Changelog:
	Allocate the correct nr of bytes for lpszCookies in HTTP_HttpOpenRequestA.
	Allocate the correct nr of bytes for request stringlen without options.

Index: dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.51
diff -u -r1.51 http.c
--- dlls/wininet/http.c	22 Mar 2004 20:40:46 -0000	1.51
+++ dlls/wininet/http.c	22 Mar 2004 20:56:42 -0000
@@ -648,13 +648,13 @@
         HeapFree(GetProcessHeap(), 0, agent_header);
     }
 
-    lpszUrl = HeapAlloc(GetProcessHeap(), 0, strlen(lpwhr->lpszHostName) + 1 + 7);
+    lpszUrl = HeapAlloc(GetProcessHeap(), 0, strlen(lpwhr->lpszHostName) + 1 + strlen("http://"));
     sprintf(lpszUrl, "http://%s", lpwhr->lpszHostName);
     if (InternetGetCookieA(lpszUrl, NULL, NULL, &nCookieSize))
     {
         int cnt = 0;
 
-        lpszCookies = HeapAlloc(GetProcessHeap(), 0, nCookieSize + 1 + 8);
+        lpszCookies = HeapAlloc(GetProcessHeap(), 0, nCookieSize + strlen("Cookie: ") + strlen("\r\n") + 1);
 
         cnt += sprintf(lpszCookies, "Cookie: ");
         InternetGetCookieA(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize);
@@ -1437,6 +1437,8 @@
         if (lpOptional)
         {
             requestStringLen += dwOptionalLength;
+        } else {
+            requestStringLen += 2;
         }
 
         /* Allocate string to hold entire request */



More information about the wine-patches mailing list