Do not crash if the prompt command name are binger that 260char or the
command line.
Modified: trunk/reactos/subsys/system/cmd/cmd.c
Modified: trunk/reactos/subsys/system/cmd/start.c
Modified: trunk/reactos/subsys/system/cmd/where.c
_____
Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c 2005-09-11 19:40:45 UTC
(rev 17805)
+++ trunk/reactos/subsys/system/cmd/cmd.c 2005-09-11 20:16:37 UTC
(rev 17806)
@@ -295,7 +295,7 @@
static VOID
Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
{
- TCHAR szFullName[MAX_PATH];
+ TCHAR szFullName[CMDLINE_LENGTH];
TCHAR *first = NULL;
TCHAR *rest = NULL;
TCHAR *full = NULL;
_____
Modified: trunk/reactos/subsys/system/cmd/start.c
--- trunk/reactos/subsys/system/cmd/start.c 2005-09-11 19:40:45 UTC
(rev 17805)
+++ trunk/reactos/subsys/system/cmd/start.c 2005-09-11 20:16:37 UTC
(rev 17806)
@@ -19,7 +19,7 @@
INT cmd_start (LPTSTR First, LPTSTR Rest)
{
- TCHAR szFullName[MAX_PATH];
+ TCHAR szFullName[CMDLINE_LENGTH];
TCHAR first[CMDLINE_LENGTH];
TCHAR *rest = NULL;
TCHAR *param = NULL;
@@ -117,12 +117,12 @@
if (!_tcscmp (first + 1, _T(":")) && _istalpha (*first))
{
- TCHAR szPath[MAX_PATH];
+ TCHAR szPath[CMDLINE_LENGTH];
_tcscpy (szPath, _T("A:"));
szPath[0] = _totupper (*first);
SetCurrentDirectory (szPath);
- GetCurrentDirectory (MAX_PATH, szPath);
+ GetCurrentDirectory (CMDLINE_LENGTH, szPath);
if (szPath[0] != (TCHAR)_totupper (*first))
ConErrResPuts (STRING_FREE_ERROR1);
_____
Modified: trunk/reactos/subsys/system/cmd/where.c
--- trunk/reactos/subsys/system/cmd/where.c 2005-09-11 19:40:45 UTC
(rev 17805)
+++ trunk/reactos/subsys/system/cmd/where.c 2005-09-11 20:16:37 UTC
(rev 17806)
@@ -86,7 +86,7 @@
BOOL
SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR
pExtension)
{
- TCHAR szPathBuffer[MAX_PATH];
+ TCHAR szPathBuffer[CMDLINE_LENGTH];
LPTSTR pszBuffer = NULL;
DWORD dwBuffer, len;
LPTSTR s,f;
@@ -106,7 +106,7 @@
#endif
if (GetFullPathName (pFileName,
- MAX_PATH,
+ CMDLINE_LENGTH,
szPathBuffer,
&pFilePart) ==0)
return FALSE;
@@ -129,7 +129,7 @@
}
/* search in current directory */
- len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
+ len = GetCurrentDirectory (CMDLINE_LENGTH, szPathBuffer);
if (szPathBuffer[len - 1] != _T('\\'))
{
szPathBuffer[len] = _T('\\');