Commit 82d413d9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

wininet: Use heap_strndupAtoW in InternetOpenUrlA.

parent d282a642
...@@ -3706,9 +3706,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, ...@@ -3706,9 +3706,8 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext) LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
{ {
HINTERNET rc = NULL; HINTERNET rc = NULL;
DWORD lenHeaders = 0;
LPWSTR szUrl = NULL; LPWSTR szUrl = NULL;
LPWSTR szHeaders = NULL; WCHAR *headers = NULL;
TRACE("\n"); TRACE("\n");
...@@ -3719,20 +3718,17 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, ...@@ -3719,20 +3718,17 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl,
} }
if(lpszHeaders) { if(lpszHeaders) {
lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 ); headers = heap_strndupAtoW(lpszHeaders, dwHeadersLength, &dwHeadersLength);
szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR)); if(!headers) {
if(!szHeaders) {
heap_free(szUrl); heap_free(szUrl);
return NULL; return NULL;
} }
MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, szHeaders, lenHeaders);
} }
rc = InternetOpenUrlW(hInternet, szUrl, szHeaders, rc = InternetOpenUrlW(hInternet, szUrl, headers, dwHeadersLength, dwFlags, dwContext);
lenHeaders, dwFlags, dwContext);
heap_free(szUrl); heap_free(szUrl);
heap_free(szHeaders); heap_free(headers);
return rc; return rc;
} }
......
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