mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 22:42:52 +08:00
Make sure we include the null terminator in XLookupStringAsUTF8()
Fixes https://github.com/libsdl-org/SDL/issues/6728
(cherry picked from commit 4106697774)
This commit is contained in:
@@ -756,7 +756,7 @@ static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int
|
|||||||
{
|
{
|
||||||
int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);
|
int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out);
|
||||||
if (IsHighLatin1(buffer_return, result)) {
|
if (IsHighLatin1(buffer_return, result)) {
|
||||||
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result);
|
char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result + 1);
|
||||||
if (utf8_text) {
|
if (utf8_text) {
|
||||||
SDL_strlcpy(buffer_return, utf8_text, bytes_buffer);
|
SDL_strlcpy(buffer_return, utf8_text, bytes_buffer);
|
||||||
SDL_free(utf8_text);
|
SDL_free(utf8_text);
|
||||||
|
|||||||
Reference in New Issue
Block a user