Do not crash if the prompt command name are binger that 260char or the command line.
authorMagnus Olsen <magnus@greatlord.com>
Sun, 11 Sep 2005 20:16:37 +0000 (20:16 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Sun, 11 Sep 2005 20:16:37 +0000 (20:16 +0000)
svn path=/trunk/; revision=17806

reactos/subsys/system/cmd/cmd.c
reactos/subsys/system/cmd/start.c
reactos/subsys/system/cmd/where.c

index 491b4b8..405875b 100644 (file)
@@ -295,7 +295,7 @@ static BOOL RunFile(LPTSTR filename)
 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; 
index 6342e59..c1b676d 100644 (file)
@@ -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 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
        
        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);
 
index 304b7dc..5557340 100644 (file)
@@ -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 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
 #endif
 
                if (GetFullPathName (pFileName,
-                                    MAX_PATH,
+                                    CMDLINE_LENGTH,
                                     szPathBuffer,
                                     &pFilePart)  ==0)
                        return FALSE;
@@ -129,7 +129,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
        }
 
        /* search in current directory */
-       len = GetCurrentDirectory (MAX_PATH, szPathBuffer);
+       len = GetCurrentDirectory (CMDLINE_LENGTH, szPathBuffer);
        if (szPathBuffer[len - 1] != _T('\\'))
        {
                szPathBuffer[len] = _T('\\');