Commit f7e7cd4a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Truncate version data if provided buffer is not large enough.

parent ed739334
...@@ -325,7 +325,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_PE( LPCSTR filename, LPDWORD hand ...@@ -325,7 +325,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_PE( LPCSTR filename, LPDWORD hand
if(data) if(data)
{ {
if(datasize >= len) if(datasize < len)
len = datasize; /* truncate data */
if(len)
memcpy(data, buf, len); memcpy(data, buf, len);
else else
len = 0xFFFFFFFF; len = 0xFFFFFFFF;
...@@ -405,7 +407,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_16( LPCSTR filename, LPDWORD hand ...@@ -405,7 +407,9 @@ static DWORD WINAPI VERSION_GetFileVersionInfo_16( LPCSTR filename, LPDWORD hand
if(data) if(data)
{ {
if(datasize >= len) if(datasize < len)
len = datasize; /* truncate data */
if(len)
memcpy(data, buf, len); memcpy(data, buf, len);
else else
len = 0xFFFFFFFF; len = 0xFFFFFFFF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment