From fc6d0b3bc787bfe39d2638a00c0a75fe7de07129 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 1 Aug 2007 10:39:49 +0000 Subject: [PATCH] Allocate correct amount of memory. See issue #2499 for more details. svn path=/trunk/; revision=28066 --- reactos/base/shell/cmd/dir.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/base/shell/cmd/dir.c b/reactos/base/shell/cmd/dir.c index 71912ead218..866a68ab2a1 100644 --- a/reactos/base/shell/cmd/dir.c +++ b/reactos/base/shell/cmd/dir.c @@ -364,10 +364,10 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */ 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 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */ /* 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)) {