Author: weiden
Date: Wed Aug 1 14:39:49 2007
New Revision: 28066
URL:
http://svn.reactos.org/svn/reactos?rev=28066&view=rev
Log:
Allocate correct amount of memory.
See issue #2499 for more details.
Modified:
trunk/reactos/base/shell/cmd/dir.c
Modified: trunk/reactos/base/shell/cmd/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/dir.c?rev=2…
==============================================================================
--- trunk/reactos/base/shell/cmd/dir.c (original)
+++ trunk/reactos/base/shell/cmd/dir.c Wed Aug 1 14:39:49 2007
@@ -364,10 +364,10 @@
cCurSwitch = _T(' ');
if(ptrStart && ptrEnd)
{
- temp = cmd_alloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ temp = cmd_alloc(((ptrEnd - ptrStart) + 2) * sizeof (TCHAR));
if(!temp)
return FALSE;
- memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ memcpy(temp, ptrStart, ((ptrEnd - ptrStart) + 2) * sizeof (TCHAR));
temp[(ptrEnd - ptrStart + 1)] = _T('\0');
if(!add_entry(entries, params, temp))
{
@@ -396,10 +396,10 @@
/* Process a character for parameter */
if ((cCurSwitch == _T(' ')) && ptrStart && ptrEnd)
{
- temp = cmd_alloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ temp = cmd_alloc(((ptrEnd - ptrStart) + 2) * sizeof (TCHAR));
if(!temp)
return FALSE;
- memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ memcpy(temp, ptrStart, ((ptrEnd - ptrStart) + 2) * sizeof (TCHAR));
temp[(ptrEnd - ptrStart + 1)] = _T('\0');
if(!add_entry(entries, params, temp))
{