mirror of
https://github.com/reactos/reactos.git
synced 2025-06-22 15:10:23 +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
1 changed files with 3 additions and 3 deletions
|
@ -569,10 +569,10 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */
|
|||
/* 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))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue