Fabian Maurer : regedit: Don't crash if REG_SZ is empty.

Alexandre Julliard julliard at winehq.org
Mon Oct 2 15:46:22 CDT 2017


Module: wine
Branch: master
Commit: 8e9a469e9c24ee3aa05e8fe5b4a728295bb79e8b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8e9a469e9c24ee3aa05e8fe5b4a728295bb79e8b

Author: Fabian Maurer <dark.shadow4 at web.de>
Date:   Mon Oct  2 08:05:21 2017 +0000

regedit: Don't crash if REG_SZ is empty.

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/regproc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 6e6ea47..508a8a3 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -1243,11 +1243,12 @@ static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
 
 static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
 {
-    size_t len, line_len;
+    size_t len = 0, line_len;
     WCHAR *str;
     static const WCHAR fmt[] = {'"','%','s','"',0};
 
-    len = size / sizeof(WCHAR) - 1;
+    if (size)
+        len = size / sizeof(WCHAR) - 1;
     str = REGPROC_escape_string(data, len, &line_len);
     *buf = heap_xalloc((line_len + 3) * sizeof(WCHAR));
     sprintfW(*buf, fmt, str);




More information about the wine-cvs mailing list