winex11: Have ToUnicodeEx null-terminate the output buffer, if there's room.
This commit is contained in:
parent
c2f3c1114f
commit
3fa4da76ea
|
@ -2680,6 +2680,12 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
|
||||||
found:
|
found:
|
||||||
if (buf != lpChar)
|
if (buf != lpChar)
|
||||||
HeapFree(GetProcessHeap(), 0, lpChar);
|
HeapFree(GetProcessHeap(), 0, lpChar);
|
||||||
|
|
||||||
|
/* Null-terminate the buffer, if there's room. MSDN clearly states that the
|
||||||
|
caller must not assume this is done, but some programs (e.g. Audiosurf) do. */
|
||||||
|
if (1 <= ret && ret < bufW_size)
|
||||||
|
bufW[ret] = 0;
|
||||||
|
|
||||||
TRACE_(key)("returning %d with %s\n", ret, debugstr_wn(bufW, ret));
|
TRACE_(key)("returning %d with %s\n", ret, debugstr_wn(bufW, ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue