From 0beadea57474f188503d20b41961e6c6ab2120b2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 26 Jun 2019 01:29:01 -0400 Subject: [PATCH] windows: Call GetWindowText() with the correct parameters (thanks, Zebediah!) GetWindowText() wants you to tell it the size of the buffer--including the terminating NULL char--but we weren't counting that last char, losing the last char of the string in the process. This was only seen with the special case of SDL_CreateWindowFrom() to use an existing native window, not the usual SDL_CreateWindow() codepath. Fixes Bugzilla #4696. --- src/video/windows/SDL_windowswindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 5ad8d9e68..ce55d6da1 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -386,7 +386,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) titleLen = GetWindowTextLength(hwnd); title = SDL_small_alloc(TCHAR, titleLen + 1, &isstack); if (title) { - titleLen = GetWindowText(hwnd, title, titleLen); + titleLen = GetWindowText(hwnd, title, titleLen + 1); } else { titleLen = 0; }