Author: hpoussin
Date: Mon Mar 26 02:42:37 2007
New Revision: 26176
URL:
http://svn.reactos.org/svn/reactos?rev=26176&view=rev
Log:
Allocate enough memory to copy string
See issue #2107 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 Mon Mar 26 02:42:37 2007
@@ -568,11 +568,11 @@
}
/* Terminate the parameters */
if(ptrStart && ptrEnd)
- {
- temp = malloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ {
+ temp = malloc((ptrEnd - ptrStart + 2) * sizeof(TCHAR));
if(!temp)
return FALSE;
- memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ memcpy(temp, ptrStart, (ptrEnd - ptrStart + 1) * sizeof(TCHAR));
temp[(ptrEnd - ptrStart + 1)] = _T('\0');
if(!add_entry(entries, params, temp))
{