Hugh McMaster : regedit: Fail when parsing any hex data type that is greater than ULONG_MAX on Windows.

Alexandre Julliard julliard at winehq.org
Wed Jun 21 16:43:44 CDT 2017


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

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Wed Jun 21 12:18:53 2017 +0000

regedit: Fail when parsing any hex data type that is greater than ULONG_MAX on Windows.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/regproc.c       | 5 +++--
 programs/regedit/tests/regedit.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index e75ebec..bc488d3 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -21,6 +21,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include <errno.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -319,8 +320,8 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
             DWORD val;
 
             /* "hex(xx):" is special */
-            val = strtoulW(*line, &end, 16);
-            if (!**line || *end != ')' || *(end + 1) != ':')
+            val = wcstoul(*line, &end, 16);
+            if (!**line || *end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE))
                 return FALSE;
 
             parser->data_type = val;
diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c
index 96091f8..79f7571 100644
--- a/programs/regedit/tests/regedit.c
+++ b/programs/regedit/tests/regedit.c
@@ -464,7 +464,7 @@ static void test_basic_import(void)
     verify_reg(hkey, "Wine13f", 0xffff, "Value", 6, 0);
     verify_reg(hkey, "Wine13g", 0x7fffffff, "Value", 6, 0);
     verify_reg(hkey, "Wine13h", 0xffffffff, "Value", 6, 0);
-    todo_wine verify_reg_nonexist(hkey, "Wine13i");
+    verify_reg_nonexist(hkey, "Wine13i");
 
     RegCloseKey(hkey);
 




More information about the wine-cvs mailing list