mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
Allocate correct amount of memory.
See issue #2499 for more details. svn path=/trunk/; revision=28066
This commit is contained in:
parent
df91a99233
commit
fc6d0b3bc7
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue