mirror of
https://github.com/reactos/reactos.git
synced 2024-07-30 16:18:43 +00:00
fix potential buffer overflow
svn path=/trunk/; revision=33725
This commit is contained in:
parent
6fdb1140a3
commit
d0a0a529f1
|
@ -90,9 +90,22 @@ GetDllList()
|
||||||
LPWSTR lpBuffer = (LPWSTR)kvpInfo->Data;
|
LPWSTR lpBuffer = (LPWSTR)kvpInfo->Data;
|
||||||
if (lpBuffer != UNICODE_NULL)
|
if (lpBuffer != UNICODE_NULL)
|
||||||
{
|
{
|
||||||
RtlMoveMemory(szAppInit,
|
INT bytesToCopy, nullPos;
|
||||||
kvpInfo->Data,
|
|
||||||
min(kvpInfo->DataLength, KEY_LENGTH));
|
bytesToCopy = min(kvpInfo->DataLength, KEY_LENGTH * sizeof(WCHAR));
|
||||||
|
|
||||||
|
if (bytesToCopy != 0)
|
||||||
|
{
|
||||||
|
RtlMoveMemory(szAppInit,
|
||||||
|
kvpInfo->Data,
|
||||||
|
bytesToCopy);
|
||||||
|
|
||||||
|
nullPos = (bytesToCopy / sizeof(WCHAR)) - 1;
|
||||||
|
|
||||||
|
/* ensure string is terminated */
|
||||||
|
szAppInit[nullPos] = UNICODE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue