From 50e743d80f159d7bc32d0d4d7dc6fc034d0d605c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 13 Mar 2018 12:50:59 +0100 Subject: [PATCH] Fix buffer size for call of function GetWindowText Cppcheck found this issue: Multiplying sizeof() with sizeof() indicates a logic error. GetWindowText expects the number of characters (3. argument) that fit into the buffer (2. argument). So a division seems to be correct here instead of a multiplication. --- clientsetup/win/CAShutdownBOINCManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clientsetup/win/CAShutdownBOINCManager.cpp b/clientsetup/win/CAShutdownBOINCManager.cpp index 6ea1fd44b6..66e9df45c5 100644 --- a/clientsetup/win/CAShutdownBOINCManager.cpp +++ b/clientsetup/win/CAShutdownBOINCManager.cpp @@ -83,7 +83,7 @@ UINT CAShutdownBOINCManager::OnExecution() hWndBOINCManagerSystray = FindWindow( _T("wxTaskBarExWindowClass"), _T("BOINCManagerSystray") ); if ( NULL != hWndBOINCManagerSystray ) { - GetWindowText( hWndBOINCManagerSystray, szWindowTitle, (sizeof(szWindowTitle) * sizeof(TCHAR))); + GetWindowText( hWndBOINCManagerSystray, szWindowTitle, (sizeof(szWindowTitle) / sizeof(TCHAR))); LogProgress( szWindowTitle ); lrReturnValue = SendMessage( hWndBOINCManagerSystray, WM_TASKBARSHUTDOWN, NULL, NULL );