mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Allocate correct amount of memory.
See issue #2499 for more details. svn path=/trunk/; revision=28066
This commit is contained in:
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user