Commit 60c8dfdd authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Prevent buffer over-read when querying REG_NONE values with no data.

parent 1dd785d1
...@@ -50,7 +50,15 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes) ...@@ -50,7 +50,15 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes)
WCHAR *ptr; WCHAR *ptr;
buffer = malloc((size_bytes * 2 + 1) * sizeof(WCHAR)); buffer = malloc((size_bytes * 2 + 1) * sizeof(WCHAR));
if (!size_bytes)
{
*buffer = 0;
break;
}
ptr = buffer; ptr = buffer;
for (i = 0; i < size_bytes; i++) for (i = 0; i < size_bytes; i++)
ptr += swprintf(ptr, 3, L"%02X", src[i]); ptr += swprintf(ptr, 3, L"%02X", src[i]);
break; break;
......
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