[PATCH 2/3] reg: Avoid allocating zero bytes of memory when handling REG_BINARY data

Hugh McMaster hugh.mcmaster at outlook.com
Thu May 6 07:47:54 CDT 2021


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/reg/add.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/programs/reg/add.c b/programs/reg/add.c
index cb26c232de3..0236dfb4742 100644
--- a/programs/reg/add.c
+++ b/programs/reg/add.c
@@ -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);
 
-- 
2.31.1




More information about the wine-devel mailing list