mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 18:46:29 +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;
|
LPTSTR p;
|
||||||
TCHAR szOptions[4];
|
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);
|
ConOutResPuts(STRING_COPY_HELP1);
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
|
||||||
DeleteFileList (sources);
|
DeleteFileList (sources);
|
||||||
freep ((VOID*)p);
|
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);
|
ConOutPrintf (szMsg, copied);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -73,7 +73,7 @@ RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
|
||||||
LONGLONG FileSize;
|
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);
|
fh = FindFirstFile(lpFileName, &f);
|
||||||
FileSize = ((LONGLONG)f.nFileSizeHigh * ((LONGLONG)MAXDWORD+1)) + (LONGLONG)f.nFileSizeLow;
|
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 */
|
/* Check that first element is % then an alpha char followed by space */
|
||||||
if ((*param != _T('%')) || !_istalpha (*(param + 1)) || !_istspace (*(param + 2)))
|
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);
|
error_syntax (szMsg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
||||||
return 0;
|
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);
|
p = split (param, &argc, FALSE);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ VOID ShortVersion (VOID)
|
||||||
(RosVersion - VersionInfo.szCSDVersion);
|
(RosVersion - VersionInfo.szCSDVersion);
|
||||||
if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7))
|
if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion, _T("ReactOS"), 7))
|
||||||
{
|
{
|
||||||
LoadString( CMD_ModuleHandle, STRING_VERSION_RUNVER, (LPTSTR) szMsg,sizeof(szMsg));
|
LoadString( CMD_ModuleHandle, STRING_VERSION_RUNVER, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
|
||||||
ConOutPrintf (szMsg, RosVersion);
|
ConOutPrintf (szMsg, RosVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,12 +517,12 @@ void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (pAPLI->bHung)
|
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);
|
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
|
||||||
}
|
}
|
||||||
else
|
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);
|
_tcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
|
||||||
nid.hIcon = hIcon;
|
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());
|
wsprintf(nid.szTip, szMsg, PerfDataGetProcessorUsage());
|
||||||
|
|
||||||
bRetVal = Shell_NotifyIcon(NIM_ADD, &nid);
|
bRetVal = Shell_NotifyIcon(NIM_ADD, &nid);
|
||||||
|
|
Loading…
Reference in a new issue