reg: Fix a heap corruption when printing specific REG_MULTI_SZ values.
Sebastian Lackner
sebastian at fds-team.de
Fri Apr 22 12:35:01 CDT 2016
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
The current calculation does not take the terminating \0 into account.
programs/reg/reg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index 6480f2c..32e75a0 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -587,7 +587,7 @@ static WCHAR *reg_data_to_wchar(DWORD type, const BYTE *src, DWORD size_bytes)
}
tmp_size = size_bytes - two_wchars; /* exclude both null terminators */
- buffer = HeapAlloc(GetProcessHeap(), 0, tmp_size * 2);
+ buffer = HeapAlloc(GetProcessHeap(), 0, tmp_size * 2 + sizeof(WCHAR));
len = tmp_size / sizeof(WCHAR);
for (i = 0, destindex = 0; i < len; i++, destindex++)
--
2.7.1
More information about the wine-patches
mailing list