Commit 9d61aee3 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Allocate the correct nr of bytes for lpszCookies in HTTP_HttpOpenRequestA.

Allocate the correct nr of bytes for request stringlen without options.
parent 4161a8b4
...@@ -648,13 +648,13 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession, ...@@ -648,13 +648,13 @@ HINTERNET WINAPI HTTP_HttpOpenRequestA(HINTERNET hHttpSession,
HeapFree(GetProcessHeap(), 0, agent_header); 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); sprintf(lpszUrl, "http://%s", lpwhr->lpszHostName);
if (InternetGetCookieA(lpszUrl, NULL, NULL, &nCookieSize)) if (InternetGetCookieA(lpszUrl, NULL, NULL, &nCookieSize))
{ {
int cnt = 0; 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: "); cnt += sprintf(lpszCookies, "Cookie: ");
InternetGetCookieA(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize); InternetGetCookieA(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize);
...@@ -1437,6 +1437,8 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, ...@@ -1437,6 +1437,8 @@ BOOL WINAPI HTTP_HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders,
if (lpOptional) if (lpOptional)
{ {
requestStringLen += dwOptionalLength; requestStringLen += dwOptionalLength;
} else {
requestStringLen += 2;
} }
/* Allocate string to hold entire request */ /* Allocate string to hold entire request */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment