diff --git a/sysui/source/win32/QuickStart/QuickStart.cpp b/sysui/source/win32/QuickStart/QuickStart.cpp index 07fef24402e5..fb2408b2ca93 100644 --- a/sysui/source/win32/QuickStart/QuickStart.cpp +++ b/sysui/source/win32/QuickStart/QuickStart.cpp @@ -3,6 +3,8 @@ #include "stdafx.h" #include "resource.h" +#include +#include #define MY_TASKBAR_NOTIFICATION WM_USER+1 @@ -47,14 +49,19 @@ bool launchSoffice( ) { // UINT ret = WinExec( "h:\\office60.630b\\program\\swriter.exe -bean", SW_SHOW ); char filename[_MAX_PATH + 1]; + + filename[_MAX_PATH] = 0; GetModuleFileName( NULL, filename, _MAX_PATH ); // soffice resides in the same dir char *p = strrchr( filename, '\\' ); if ( !p ) return false; - strcpy( p+1, "soffice.exe" ); + + strncpy( p+1, "soffice.exe", _MAX_PATH - (p+1 - filename) ); char imagename[_MAX_PATH + 1]; - wsprintf(imagename, "\"%s\" -quickstart", filename ); + + imagename[_MAX_PATH] = 0; + _snprintf(imagename, _MAX_PATH, "\"%s\" -quickstart", filename ); UINT ret = WinExec( imagename, SW_SHOW ); if ( ret < 32 ) @@ -94,10 +101,11 @@ void NotifyListener( HWND hWnd ) nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWnd; nid.uID = IDM_QUICKSTART; + nid.szTip[elementsof(nid.szTip) - 1] = 0; // nid.hIcon = bTerminateVeto ? hIconActive : hIconInActive; -// strcpy(nid.szTip, bTerminateVeto ? STRING_QUICKSTARTACTIVE : STRING_QUICKSTARTINACTIVE); +// strncpy(nid.szTip, bTerminateVeto ? STRING_QUICKSTARTACTIVE : STRING_QUICKSTARTINACTIVE, elementsof(nid.szTip) - 1 ); nid.hIcon = hIconActive; - strcpy(nid.szTip, szTooltipString); + strncpy(nid.szTip, szTooltipString, elementsof(nid.szTip) - 1); nid.uFlags = NIF_TIP|NIF_ICON; // update systray