[PATCH 3/5] regedit: Only import a DWORD followed by other data if that data begins with a semicolon

Hugh McMaster hugh.mcmaster at outlook.com
Mon Apr 10 04:50:40 CDT 2017


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/regedit/regproc.c       |  5 ++++-
 programs/regedit/tests/regedit.c | 16 ++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index a44a733..4b71a29 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -153,7 +153,10 @@ static BOOL convertHexToDWord(WCHAR* str, DWORD *dw)
     if (!buf) return FALSE;
 
     *dw = strtoul(buf, &end, 16);
-    if (*dw == ~0u && errno == ERANGE)
+
+    while (*end == ' ' || *end == '\t') end++;
+
+    if ((*dw == ~0u && errno == ERANGE) || (*end && *end != ';'))
     {
         output_message(STRING_INVALID_HEX);
         HeapFree(GetProcessHeap(), 0, buf);
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index 7e8666a..d14bb05 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -512,7 +512,7 @@ static void test_invalid_import(void)
                     "\"Test12c\"=dword:123456789\n"
                     "\"Test12d\"=dword:012345678\n\n");
     todo_wine verify_reg_nonexist(hkey, "Test12a");
-    todo_wine verify_reg_nonexist(hkey, "Test12b");
+    verify_reg_nonexist(hkey, "Test12b");
     verify_reg_nonexist(hkey, "Test12c");
     todo_wine verify_reg_nonexist(hkey, "Test12d");
 
@@ -521,7 +521,7 @@ static void test_invalid_import(void)
                     "\"Test13a\"=dword:12345678abc\n"
                     "\"Test13b\"=dword:12345678 abc\n\n");
     verify_reg_nonexist(hkey, "Test13a");
-    todo_wine verify_reg_nonexist(hkey, "Test13b");
+    verify_reg_nonexist(hkey, "Test13b");
 
     exec_import_str("REGEDIT4\n\n"
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
@@ -529,8 +529,8 @@ static void test_invalid_import(void)
                     "\"Test14b\"=dword:123 456\n"
                     "\"Test14c\"=dword:1234 5678\n\n");
     todo_wine verify_reg_nonexist(hkey, "Test14a");
-    todo_wine verify_reg_nonexist(hkey, "Test14b");
-    todo_wine verify_reg_nonexist(hkey, "Test14c");
+    verify_reg_nonexist(hkey, "Test14b");
+    verify_reg_nonexist(hkey, "Test14c");
 
     RegCloseKey(hkey);
 
@@ -566,7 +566,7 @@ static void test_comments(void)
                     "\"Wine6\"=dword:02040608 ;comment\n\n");
     verify_reg_nonexist(hkey, "Wine3");
     todo_wine verify_reg(hkey, "Wine4", REG_SZ, "Value 2", 8, 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine5");
+    verify_reg_nonexist(hkey, "Wine5");
     dword = 0x2040608;
     verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
 
@@ -626,7 +626,7 @@ static void test_comments(void)
     verify_reg(hkey, "Wine20", REG_SZ, "Value ;comment6", 16, 0);
     verify_reg_nonexist(hkey, "Wine21");
     verify_reg_nonexist(hkey, "Wine22");
-    todo_wine verify_reg_nonexist(hkey, "Wine23");
+    verify_reg_nonexist(hkey, "Wine23");
     dword = 0x00000004;
     verify_reg(hkey, "Wine24", REG_DWORD, &dword, sizeof(dword), 0);
 
@@ -639,8 +639,8 @@ static void test_comments(void)
     dword = 0x1234;
     verify_reg(hkey, "Wine25a", REG_DWORD, &dword, sizeof(dword), 0);
     verify_reg(hkey, "Wine25b", REG_DWORD, &dword, sizeof(dword), 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine25c");
-    todo_wine verify_reg_nonexist(hkey, "Wine25d");
+    verify_reg_nonexist(hkey, "Wine25c");
+    verify_reg_nonexist(hkey, "Wine25d");
 
     exec_import_str("REGEDIT4\n\n"
                     "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
-- 
2.7.4




More information about the wine-patches mailing list