Added patch to fix crash when exporting REG_SZ data if size == 0.

This commit is contained in:
Sebastian Lackner 2017-09-30 18:48:25 +02:00
parent 4c7e1e892a
commit dd1a215bef
3 changed files with 57 additions and 0 deletions

View File

@ -326,6 +326,7 @@ patch_enable_all ()
enable_packager_DllMain="$1"
enable_quartz_MediaSeeking_Positions="$1"
enable_quartz_Silence_FIXMEs="$1"
enable_regedit_export_string_data="$1"
enable_riched20_Class_Tests="$1"
enable_riched20_IText_Interface="$1"
enable_rpcrt4_Race_Condition="$1"
@ -1259,6 +1260,9 @@ patch_enable ()
quartz-Silence_FIXMEs)
enable_quartz_Silence_FIXMEs="$2"
;;
regedit-export_string_data)
enable_regedit_export_string_data="$2"
;;
riched20-Class_Tests)
enable_riched20_Class_Tests="$2"
;;
@ -7484,6 +7488,21 @@ if test "$enable_quartz_Silence_FIXMEs" -eq 1; then
) >> "$patchlist"
fi
# Patchset regedit-export_string_data
# |
# | This patchset fixes the following Wine bugs:
# | * [#43805] Fix crash when exporting REG_SZ data if size == 0
# |
# | Modified files:
# | * programs/regedit/regproc.c
# |
if test "$enable_regedit_export_string_data" -eq 1; then
patch_apply regedit-export_string_data/0001-regedit-Don-t-crash-if-REG_SZ-is-empty.patch
(
printf '%s\n' '+ { "Fabian Maurer", "regedit: Don'\''t crash if REG_SZ is empty.", 1 },';
) >> "$patchlist"
fi
# Patchset riched20-Class_Tests
# |
# | Modified files:

View File

@ -0,0 +1,37 @@
From 66a5b81f6d880bcb6f3ea251e1fe695a60a27379 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Sat, 30 Sep 2017 18:14:11 +0200
Subject: regedit: Don't crash if REG_SZ is empty
Some reg files can result in an REG_SZ with length 0, like
"Value"=hex(1):
When exporting with size == 0 we need to account for this case
and set the length to 0 to avoid an underflow.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
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 6e6ea473c75..aa1d6fa90fe 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);
--
2.14.1

View File

@ -0,0 +1 @@
Fixes: [43805] Fix crash when exporting REG_SZ data if size == 0