Don't write outside buffer

svn path=/trunk/; revision=12349
This commit is contained in:
Gé van Geldorp 2004-12-26 23:09:51 +00:00
parent 0afb1fb12d
commit 8bbd20efdc

View file

@ -1,4 +1,4 @@
/* $Id: reg.c,v 1.66 2004/12/25 11:18:50 navaraf Exp $
/* $Id: reg.c,v 1.67 2004/12/26 23:09:51 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -2505,9 +2505,16 @@ RegQueryValueExA (HKEY hKey,
Length = Length / sizeof(WCHAR);
}
else if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL)
{
if (*lpcbData < Length)
{
ErrorCode = ERROR_MORE_DATA;
}
else
{
RtlMoveMemory(lpData, ValueData.Buffer, Length);
}
}
if (lpcbData != NULL)
{