regedit: Don't crash if REG_SZ is empty.

Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Fabian Maurer 2017-10-02 08:05:21 +00:00 committed by Alexandre Julliard
parent 84d2d7818b
commit 8e9a469e9c
1 changed files with 3 additions and 2 deletions

View File

@ -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);