From b8b7979f9c77db4457c7b4713b484b6fa2c2f8e1 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Fri, 12 Mar 2021 22:27:33 +1100 Subject: [PATCH] regedit: Stop parsing REG_SZ values containing NUL character sequences. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- programs/regedit/regproc.c | 3 +-- programs/regedit/tests/regedit.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 727f39f6158..5bb991865e6 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -402,8 +402,7 @@ static BOOL REGPROC_unescape_string(WCHAR *str, WCHAR **unparsed) str[val_idx] = '\r'; break; case '0': - str[val_idx] = '\0'; - break; + return FALSE; case '\\': case '"': str[val_idx] = str[str_idx]; diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index 9b431fa6f38..7d2c9416bcc 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -1694,12 +1694,12 @@ static void test_invalid_import(void) "\"Wine33d\"=\"Value2\\0\\0\\0\\0\"\n" "\"Wine33e\"=\"Value3\\0Value4\"\n" "\"Wine33f\"=\"\\0Value5\"\n\n"); - todo_wine verify_reg_nonexist(hkey, "Wine33a"); - todo_wine verify_reg_nonexist(hkey, "Wine33b"); - todo_wine verify_reg_nonexist(hkey, "Wine33c"); - todo_wine verify_reg_nonexist(hkey, "Wine33d"); - todo_wine verify_reg_nonexist(hkey, "Wine33e"); - todo_wine verify_reg_nonexist(hkey, "Wine33f"); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + verify_reg_nonexist(hkey, "Wine33f"); close_key(hkey); @@ -2205,12 +2205,12 @@ static void test_invalid_import_unicode(void) "\"Wine33d\"=\"Value2\\0\\0\\0\\0\"\n" "\"Wine33e\"=\"Value3\\0Value4\"\n" "\"Wine33f\"=\"\\0Value5\"\n\n"); - todo_wine verify_reg_nonexist(hkey, "Wine33a"); - todo_wine verify_reg_nonexist(hkey, "Wine33b"); - todo_wine verify_reg_nonexist(hkey, "Wine33c"); - todo_wine verify_reg_nonexist(hkey, "Wine33d"); - todo_wine verify_reg_nonexist(hkey, "Wine33e"); - todo_wine verify_reg_nonexist(hkey, "Wine33f"); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + verify_reg_nonexist(hkey, "Wine33f"); close_key(hkey);