Rob Shearman : wininet: Cope with non-nul-terminated header strings being passed to HttpSendRequestW .

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 29 08:05:39 CDT 2007


Module: wine
Branch: master
Commit: 2e21d090cb35f946b8fb2af79256272356b810a9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2e21d090cb35f946b8fb2af79256272356b810a9

Author: Rob Shearman <rob at 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;




More information about the wine-cvs mailing list