From 0e42073cd799cd721ea88b313e2760d713e78f5f Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 30 Jun 2004 18:17:07 +0000 Subject: [PATCH] HeapAlloc for WSTR must allocate len* sizeof(WCHARS). --- dlls/hhctrl.ocx/hhctrl.c | 2 +- dlls/imm32/imm.c | 4 ++-- dlls/mpr/wnet.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c index 98aadfaade1..40c186901e8 100644 --- a/dlls/hhctrl.ocx/hhctrl.c +++ b/dlls/hhctrl.ocx/hhctrl.c @@ -47,7 +47,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data) DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); HWND result; - wfile = HeapAlloc( GetProcessHeap(), 0, len ); + wfile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len ); result = HtmlHelpW( caller, wfile, command, data ); diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 219b83eb7c5..30067fd79a2 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1265,14 +1265,14 @@ BOOL WINAPI ImmSetCompositionStringA( comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0); if (comp_len) { - CompBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,comp_len); + CompBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,comp_len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, CompBuffer, comp_len); } read_len = MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, NULL, 0); if (read_len) { - ReadBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,read_len); + ReadBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,read_len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, ReadBuffer, read_len); } diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 807046043ac..25630309056 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -1540,7 +1540,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName, if (len) { - PWSTR wideLocalName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, len); + PWSTR wideLocalName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wideLocalName) {