reg: Avoid allocating zero bytes of memory when handling REG_BINARY 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:54 +10:00 committed by Alexandre Julliard
parent e2dfb0aff4
commit 1dd785d149
1 changed files with 2 additions and 0 deletions

View File

@ -89,6 +89,8 @@ static BOOL get_regdata(const WCHAR *data, DWORD reg_type, WCHAR separator,
BYTE hex0, hex1, *ptr;
int i = 0, destByteIndex = 0, datalen = lstrlenW(data);
if (!datalen) return TRUE;
*size_bytes = ((datalen + datalen % 2) / 2) * sizeof(BYTE);
*data_bytes = malloc(*size_bytes);