From 7c774e98494d7392bc78bd3a8b2a2afd5ea0afe5 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 22 Apr 2016 19:35:01 +0200 Subject: [PATCH] reg: Fix a heap corruption when printing specific REG_MULTI_SZ values. Signed-off-by: Sebastian Lackner Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- 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 6480f2cf925..32e75a08356 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.11.4.GIT