From 635ef60c534db3ed856f53ebb10eb02db7ddcd98 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 24 Aug 2021 14:23:38 +0600 Subject: [PATCH] Fix buffer overflow on window title sets --- src/unix/unix_sdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 83428bcfb..b7f3fa075 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -433,7 +433,7 @@ wchar_t* ui_window_title(wchar_t* str) SDL_SetWindowTitle(sdl_win, (char*)str); return str; } - res = SDL_iconv_string("UTF-8", sizeof(wchar_t) == 2 ? "UTF-16LE" : "UTF-32LE", (char*)str, wcslen(str) * sizeof(wchar_t)); + res = SDL_iconv_string("UTF-8", sizeof(wchar_t) == 2 ? "UTF-16LE" : "UTF-32LE", (char*)str, wcslen(str) * sizeof(wchar_t) + sizeof(wchar_t)); if (res) { SDL_SetWindowTitle(sdl_win, res);