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

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2021-05-06 22:47:55 +10:00 committed by Alexandre Julliard
parent 1dd785d149
commit 60c8dfdd0b

View file

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