mirror of
https://github.com/reactos/reactos.git
synced 2024-10-21 00:18:26 +00:00
Allocate enough memory to copy string
See issue #2107 for more details. svn path=/trunk/; revision=26176
This commit is contained in:
parent
b58b255ebf
commit
e9f5948d58
|
@ -569,10 +569,10 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */
|
||||||
/* Terminate the parameters */
|
/* Terminate the parameters */
|
||||||
if(ptrStart && ptrEnd)
|
if(ptrStart && ptrEnd)
|
||||||
{
|
{
|
||||||
temp = malloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
|
temp = malloc((ptrEnd - ptrStart + 2) * sizeof(TCHAR));
|
||||||
if(!temp)
|
if(!temp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
|
memcpy(temp, ptrStart, (ptrEnd - ptrStart + 1) * sizeof(TCHAR));
|
||||||
temp[(ptrEnd - ptrStart + 1)] = _T('\0');
|
temp[(ptrEnd - ptrStart + 1)] = _T('\0');
|
||||||
if(!add_entry(entries, params, temp))
|
if(!add_entry(entries, params, temp))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue