From dbfc417e65804c09cecf6e549de74a18639f6f7b Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Sun, 24 Jun 2018 20:44:37 +0200 Subject: Fix: [Win32] Garbage in OS window title if branch name was too long. This was caused by a missing \0-character on reaching the buffer limit. --- src/video/win32_v.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/video') diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index d1d4a4cd5..9559163c3 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -338,13 +338,13 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen) if (_wnd.main_wnd != NULL) { if (!_window_maximize) SetWindowPos(_wnd.main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE); } else { - TCHAR Windowtitle[50]; int x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; int y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; - _sntprintf(Windowtitle, lengthof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision)); + char window_title[64]; + seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision); - _wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); + _wnd.main_wnd = CreateWindow(_T("OTTD"), MB_TO_WIDE(window_title), style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); if (_wnd.main_wnd == NULL) usererror("CreateWindow failed"); ShowWindow(_wnd.main_wnd, showstyle); } -- cgit v1.2.3-70-g09d2