Notification Class: Correct array sizing in SetWindowCaption
sizeof(wchar_t) is a size of 2 (or 4 if in a Linux environment). With the previous code, it would be trying to insert the null terminator at index 511 on Windows, which is incorrect.
This commit is contained in:
parent
a7eb2e79e5
commit
e9c056e5a4
|
@ -147,9 +147,11 @@ void CNotification::SetGfxPlugin( CGfxPlugin * Plugin )
|
|||
|
||||
void CNotification::SetWindowCaption (const wchar_t * Caption)
|
||||
{
|
||||
wchar_t WinTitle[256];
|
||||
_snwprintf( WinTitle, sizeof(WinTitle), L"%s - %s", Caption, g_Settings->LoadString(Setting_ApplicationName).ToUTF16().c_str());
|
||||
WinTitle[sizeof(WinTitle) - 1] = 0;
|
||||
static const size_t TITLE_SIZE = 256;
|
||||
|
||||
wchar_t WinTitle[TITLE_SIZE];
|
||||
_snwprintf(WinTitle, TITLE_SIZE, L"%s - %s", Caption, g_Settings->LoadString(Setting_ApplicationName).ToUTF16().c_str());
|
||||
WinTitle[TITLE_SIZE - 1] = 0;
|
||||
m_hWnd->Caption(WinTitle);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue