mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
prevent buffer overflow, LoadString accepts the size of the buffer in TCHARs, not in bytes! Please guys, read the documentation of the function _before_ you use it...
svn path=/trunk/; revision=15149
This commit is contained in:
parent
539af1d0d0
commit
54f6a09bb2
7 changed files with 16 additions and 16 deletions
|
@ -299,7 +299,7 @@ Overwrite (LPTSTR fn)
|
|||
LPTSTR p;
|
||||
TCHAR szOptions[4];
|
||||
|
||||
LoadString( CMD_ModuleHandle, STRING_COPY_OPTION, szOptions, 4);
|
||||
LoadString( CMD_ModuleHandle, STRING_COPY_OPTION, szOptions, sizeof(szOptions) / sizeof(szOptions[0]) );
|
||||
|
||||
ConOutResPuts(STRING_COPY_HELP1);
|
||||
|
||||
|
@ -760,7 +760,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
|
|||
DeleteFileList (sources);
|
||||
freep ((VOID*)p);
|
||||
|
||||
LoadString( CMD_ModuleHandle, STRING_COPY_FILE, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
LoadString( CMD_ModuleHandle, STRING_COPY_FILE, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf (szMsg, copied);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -71,9 +71,9 @@ RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
|
|||
HANDLE fh;
|
||||
WIN32_FIND_DATA f;
|
||||
LONGLONG FileSize;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LoadString( CMD_ModuleHandle, STRING_DELETE_WIPE, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
LoadString( CMD_ModuleHandle, STRING_DELETE_WIPE, szMsg, RC_STRING_MAX_SIZE);
|
||||
|
||||
fh = FindFirstFile(lpFileName, &f);
|
||||
FileSize = ((LONGLONG)f.nFileSizeHigh * ((LONGLONG)MAXDWORD+1)) + (LONGLONG)f.nFileSizeLow;
|
||||
|
|
|
@ -68,7 +68,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
|
|||
/* Check that first element is % then an alpha char followed by space */
|
||||
if ((*param != _T('%')) || !_istalpha (*(param + 1)) || !_istspace (*(param + 2)))
|
||||
{
|
||||
LoadString( CMD_ModuleHandle, STRING_FOR_ERROR, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
LoadString( CMD_ModuleHandle, STRING_FOR_ERROR, szMsg, RC_STRING_MAX_SIZE);
|
||||
error_syntax (szMsg);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
LoadString( CMD_ModuleHandle, STRING_TIMER_TIME, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
LoadString( CMD_ModuleHandle, STRING_TIMER_TIME, szMsg, RC_STRING_MAX_SIZE);
|
||||
|
||||
p = split (param, &argc, FALSE);
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ VOID ShortVersion (VOID)
|
|||
(RosVersion - VersionInfo.szCSDVersion);
|
||||
if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7))
|
||||
{
|
||||
LoadString( CMD_ModuleHandle, STRING_VERSION_RUNVER, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
ConOutPrintf (szMsg, RosVersion);
|
||||
LoadString( CMD_ModuleHandle, STRING_VERSION_RUNVER, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
|
||||
ConOutPrintf (szMsg, RosVersion);
|
||||
}
|
||||
}
|
||||
ConOutPuts (_T("\n"));
|
||||
|
|
|
@ -489,7 +489,7 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
LPNM_LISTVIEW pnmv;
|
||||
LV_DISPINFO* pnmdi;
|
||||
LPAPPLICATION_PAGE_LIST_ITEM pAPLI;
|
||||
TCHAR szMsg[256];
|
||||
TCHAR szMsg[256];
|
||||
|
||||
|
||||
idctrl = (int) wParam;
|
||||
|
@ -516,15 +516,15 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
else if (pnmdi->item.iSubItem == 1)
|
||||
{
|
||||
if (pAPLI->bHung)
|
||||
{
|
||||
LoadString( GetModuleHandle(NULL), IDS_Not_Responding , (LPTSTR) szMsg,sizeof(szMsg));
|
||||
{
|
||||
LoadString( GetModuleHandle(NULL), IDS_Not_Responding , szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
|
||||
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString( GetModuleHandle(NULL), IDS_Running, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
{
|
||||
LoadString( GetModuleHandle(NULL), IDS_Running, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
|
||||
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -149,7 +149,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
|
|||
nid.hIcon = hIcon;
|
||||
|
||||
|
||||
LoadString( GetModuleHandle(NULL), IDS_MSG_TRAYICONCPUUSAGE, (LPTSTR) szMsg,sizeof(szMsg));
|
||||
LoadString( GetModuleHandle(NULL), IDS_MSG_TRAYICONCPUUSAGE, szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
|
||||
wsprintf(nid.szTip, szMsg, PerfDataGetProcessorUsage());
|
||||
|
||||
bRetVal = Shell_NotifyIcon(NIM_ADD, &nid);
|
||||
|
|
Loading…
Reference in a new issue