Module: wine Branch: master Commit: 2e21d090cb35f946b8fb2af79256272356b810a9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e21d090cb35f946b8fb2af792...
Author: Rob Shearman rob@codeweavers.com Date: Fri May 25 12:07:26 2007 +0100
wininet: Cope with non-nul-terminated header strings being passed to HttpSendRequestW.
---
dlls/wininet/http.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 056e2fe..c410f92 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2224,8 +2224,8 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, LPWININETAPPINFOW hIC = NULL; BOOL r;
- TRACE("%p, %p (%s), %i, %p, %i)\n", hHttpRequest, - lpszHeaders, debugstr_w(lpszHeaders), dwHeaderLength, lpOptional, dwOptionalLength); + TRACE("%p, %s, %i, %p, %i)\n", hHttpRequest, + debugstr_wn(lpszHeaders, dwHeaderLength), dwHeaderLength, lpOptional, dwOptionalLength);
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hHttpRequest ); if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) @@ -2260,7 +2260,10 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, workRequest.hdr = WININET_AddRef( &lpwhr->hdr ); req = &workRequest.u.HttpSendRequestW; if (lpszHeaders) - req->lpszHeader = WININET_strdupW(lpszHeaders); + { + req->lpszHeader = HeapAlloc(GetProcessHeap(), 0, dwHeaderLength * sizeof(WCHAR)); + memcpy(req->lpszHeader, lpszHeaders, dwHeaderLength * sizeof(WCHAR)); + } else req->lpszHeader = 0; req->dwHeaderLength = dwHeaderLength;