Hugh McMaster : reg: Avoid allocating zero bytes of memory when handling REG_BINARY data.

Alexandre Julliard julliard at winehq.org
Thu May 6 14:56:19 CDT 2021


Module: wine
Branch: master
Commit: 1dd785d1490f64c33e89003453f7c82292d185d5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1dd785d1490f64c33e89003453f7c82292d185d5

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Thu May  6 22:47:54 2021 +1000

reg: Avoid allocating zero bytes of memory when handling REG_BINARY data.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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);
 




More information about the wine-cvs mailing list