Hugh McMaster : reg: Prevent buffer over-read when querying REG_NONE values with no data.
Alexandre Julliard
julliard at winehq.org
Thu May 6 14:56:19 CDT 2021
Module: wine
Branch: master
Commit: 60c8dfdd0bbaff4a2369f884ec1a553a06735676
URL: https://source.winehq.org/git/wine.git/?a=commit;h=60c8dfdd0bbaff4a2369f884ec1a553a06735676
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Thu May 6 22:47:55 2021 +1000
reg: Prevent buffer over-read when querying REG_NONE values with no data.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/query.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/programs/reg/query.c b/programs/reg/query.c
index 7e42719faf9..4886fb84bc1 100644
--- a/programs/reg/query.c
+++ b/programs/reg/query.c
@@ -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;
More information about the wine-cvs
mailing list