From f8446f260651739f8374bcd969e5643c13dce596 Mon Sep 17 00:00:00 2001 From: Muneyuki Noguchi Date: Sat, 13 Sep 2008 15:01:40 +0900 Subject: [PATCH] winex11.drv: Make X11DRV_XIMLookupChars handle a long string properly. --- dlls/winex11.drv/xim.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c index 252dacddbb6..5e413f0c2d0 100644 --- a/dlls/winex11.drv/xim.c +++ b/dlls/winex11.drv/xim.c @@ -177,15 +177,20 @@ static BOOL X11DRV_ImmSetInternalString(DWORD dwIndex, DWORD dwOffset, void X11DRV_XIMLookupChars( const char *str, DWORD count ) { DWORD dwOutput; - WCHAR wcOutput[64]; + WCHAR *wcOutput; HWND focus; - dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, str, count, wcOutput, sizeof(wcOutput)/sizeof(WCHAR)); + dwOutput = MultiByteToWideChar(CP_UNIXCP, 0, str, count, NULL, 0); + wcOutput = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * dwOutput); + if (wcOutput == NULL) + return; + MultiByteToWideChar(CP_UNIXCP, 0, str, count, wcOutput, dwOutput); if ((focus = GetFocus())) IME_UpdateAssociation(focus); X11DRV_ImmSetInternalString(GCS_RESULTSTR,0,0,wcOutput,dwOutput); + HeapFree(GetProcessHeap(), 0, wcOutput); } static void X11DRV_ImmSetOpenStatus(BOOL fOpen)