- fix cmd not to crash when just typing "start" [enter]

See issue #2294 for more details.

svn path=/trunk/; revision=27955
This commit is contained in:
Johannes Anderwald 2007-07-28 17:48:23 +00:00
parent 0a931f1a75
commit c697530b17

View file

@ -97,7 +97,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
return 1; return 1;
} }
SetLastError(0); SetLastError(0);
size = GetEnvironmentVariable (_T("COMSPEC"), comspec, 512); size = GetEnvironmentVariable (_T("COMSPEC"), comspec, MAX_PATH);
if(GetLastError() == ERROR_ENVVAR_NOT_FOUND) if(GetLastError() == ERROR_ENVVAR_NOT_FOUND)
{ {
RestWithoutArgs[0] = _T('c'); RestWithoutArgs[0] = _T('c');
@ -127,7 +127,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
_tcscat(RestWithoutArgs,_T("\"")); _tcscat(RestWithoutArgs,_T("\""));
} }
rest = malloc ( _tcslen(RestWithoutArgs) + 1 * sizeof(TCHAR)); rest = malloc ( (_tcslen(RestWithoutArgs) + 1) * sizeof(TCHAR));
if (rest == NULL) if (rest == NULL)
{ {
if(comspec != NULL) if(comspec != NULL)
@ -136,7 +136,7 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
return 1; return 1;
} }
param =malloc ( _tcslen(RestWithoutArgs) + 1 * sizeof(TCHAR)); param =malloc ( (_tcslen(RestWithoutArgs) + 1) * sizeof(TCHAR));
if (rest == NULL) if (rest == NULL)
{ {
if(comspec != NULL) if(comspec != NULL)