Author: greatlrd
Date: Sun Apr 20 01:25:30 2008
New Revision: 33043
URL:
http://svn.reactos.org/svn/reactos?rev=33043&view=rev
Log:
add back a check for the negative value
thx Christoph_vW notes this mistake.
Modified:
trunk/reactos/base/shell/cmd/cmd.c
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=3…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Sun Apr 20 01:25:30 2008
@@ -1164,15 +1164,23 @@
if (position)
{
position += 2;
- Token = _tcstok(position, _T(","));
- while ((Token != NULL) && (i < 2))
+ if (_tcschr(position, _T(',')) != NULL)
{
- StringPart[i] = _ttoi(Token);
- i++;
- Token = _tcstok (NULL, _T(","));
+ Token = _tcstok(position, _T(","));
+ while ((Token != NULL) && (i < 2))
+ {
+ StringPart[i] = _ttoi(Token);
+ i++;
+ Token = _tcstok (NULL, _T(","));
+ }
+ if (i > 0)
+ {
+ if (StringPart[1] < 0)
+ StringPart[1] = _tcslen(ret + StringPart[0]) + StringPart[1];
+ _tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
+ _tcscpy(ret, ReturnValue);
+ }
}
- _tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
- _tcscpy(ret, ReturnValue);
return ret;
}
else