Truncate version data if provided buffer is not large enough.

This commit is contained in:
Dmitry Timoshkov 2001-03-19 19:15:36 +00:00 committed by Alexandre Julliard
parent ed739334f4
commit f7e7cd4aec
1 changed files with 6 additions and 2 deletions

View File

@ -325,7 +325,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_PE( LPCSTR filename, LPDWORD hand
if(data)
{
if(datasize >= len)
if(datasize < len)
len = datasize; /* truncate data */
if(len)
memcpy(data, buf, len);
else
len = 0xFFFFFFFF;
@ -405,7 +407,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_16( LPCSTR filename, LPDWORD hand
if(data)
{
if(datasize >= len)
if(datasize < len)
len = datasize; /* truncate data */
if(len)
memcpy(data, buf, len);
else
len = 0xFFFFFFFF;