Fix too long buffer for ImmGetCompositionStringW()

It return's byte size, not string length. So that multiplying by
sizeof(WCHAR) isn't needed.
This commit is contained in:
Takuro Ashie 2022-04-14 18:30:58 +09:00 committed by Daijiro Fukuda
parent ffce1503cc
commit 169da05c53

View File

@ -858,7 +858,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
{
// get preedit data
int length = preeditTextLength / sizeof(WCHAR);
LPWSTR buffer = (LPWSTR) _glfw_calloc(preeditTextLength, sizeof(WCHAR));
LPWSTR buffer = (LPWSTR) _glfw_calloc(preeditTextLength, 1);
LPSTR attributes = (LPSTR) _glfw_calloc(attrLength, 1);
DWORD *clauses = (DWORD*) _glfw_calloc(clauseLength, 1);
ImmGetCompositionStringW(hIMC, GCS_COMPSTR, buffer, preeditTextLength);