Author: hbelusca
Date: Tue Mar 3 21:35:07 2015
New Revision: 66562
URL:
http://svn.reactos.org/svn/reactos?rev=66562&view=rev
Log:
[MPLAY32]: Fix CID 515203 and CID 515204: replace remaining _tcscpy and _stprintf with
strsafe functions.
By Ricardo Hanke.
CORE-9306 CORE-9308 #resolve #comment Fixed, thanks!
Modified:
trunk/reactos/base/applications/mplay32/mplay32.c
Modified: trunk/reactos/base/applications/mplay32/mplay32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] Tue Mar 3 21:35:07
2015
@@ -165,7 +165,7 @@
LoadString(hInstance, IDS_DEFAULTMCIERRMSG, szErrorMessage,
sizeof(szErrorMessage) / sizeof(szErrorMessage[0]));
}
- _stprintf(szTempMessage, _T("MMSYS%lu: %s"), mciError, szErrorMessage);
+ StringCbPrintf(szTempMessage, sizeof(szTempMessage), _T("MMSYS%lu: %s"),
mciError, szErrorMessage);
MessageBox(hwnd, szTempMessage, szAppTitle, MB_OK | MB_ICONEXCLAMATION);
}
@@ -412,7 +412,7 @@
MCIERROR mciError;
MCI_STATUS_PARMS mciStatus;
MCI_OPEN_PARMS mciOpen;
- TCHAR szNewTitle[MAX_PATH];
+ TCHAR szNewTitle[MAX_PATH + 128];
if (bIsOpened)
{
@@ -462,13 +462,13 @@
SendMessage(hTrackBar, TBM_SETTICFREQ, (WPARAM) 100000, (LPARAM) 0);
}
- _stprintf(szNewTitle, _T("%s - %s"), szAppTitle, lpFileName);
+ StringCbPrintf(szNewTitle, sizeof(szNewTitle), _T("%s - %s"), szAppTitle,
lpFileName);
SetWindowText(hwnd, szNewTitle);
MaxFilePos = mciStatus.dwReturn;
wDeviceId = mciOpen.wDeviceID;
bIsOpened = TRUE;
- _tcscpy(szPrevFile, lpFileName);
+ StringCbCopy(szPrevFile, sizeof(szPrevFile), lpFileName);
EnableMenuItems(hwnd);
@@ -656,11 +656,11 @@
if (szPrevFile[0] == _T('\0'))
return;
- _tcscpy(szLocalFileName, szPrevFile);
+ StringCbCopy(szLocalFileName, sizeof(szLocalFileName), szPrevFile);
}
else
{
- _tcscpy(szLocalFileName, lpFileName);
+ StringCbCopy(szLocalFileName, sizeof(szLocalFileName), lpFileName);
}
if (GetFileAttributes(szLocalFileName) == INVALID_FILE_ATTRIBUTES)
@@ -918,7 +918,7 @@
if (!GetCurrentDirectory(sizeof(szCurrentDir) / sizeof(szCurrentDir[0]),
szCurrentDir))
{
- _tcscpy(szCurrentDir, _T("c:\\"));
+ StringCbCopy(szCurrentDir, sizeof(szCurrentDir), _T("c:\\"));
}
OpenFileName.lStructSize = sizeof(OpenFileName);