mirror of
https://github.com/reactos/reactos.git
synced 2024-08-01 09:01:13 +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
|
@ -568,11 +568,11 @@ 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…
Reference in a new issue