Fix Bug 1217 with patch from bugzila by ravelo "If you type > or < in
cmd and hit ENTER, cmd.exe crashes"
Modified: trunk/reactos/subsys/system/cmd/cmd.c
_____
Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c 2005-12-29 21:45:17 UTC
(rev 20441)
+++ trunk/reactos/subsys/system/cmd/cmd.c 2005-12-29 21:46:40 UTC
(rev 20442)
@@ -1385,9 +1385,10 @@
tmp = commandline;
tmp += _tcsspn(tmp,_T(" \t"));
/* first we find and skip and
pre-redirections... */
- while ( _tcschr(_T("<>"),*tmp)
+ while (( tmp ) &&
+ ( _tcschr(_T("<>"),*tmp)
|| !_tcsncmp(tmp,_T("1>"),2)
- || !_tcsncmp(tmp,_T("2>"),2) )
+ || !_tcsncmp(tmp,_T("2>"),2) ))
{
if ( _istdigit(*tmp) )
tmp += 2;
@@ -1402,7 +1403,8 @@
}
else
tmp = _tcspbrk(tmp,_T(" \t"));
- tmp += _tcsspn(tmp,_T(" \t"));
+ if ( tmp )
+ tmp += _tcsspn(tmp,_T(" \t"));
}
/* we should now be pointing to the actual
command
* (if there is one yet)*/