Commit 8803b961 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

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

parent c0312bf7
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -319,8 +320,8 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line) ...@@ -319,8 +320,8 @@ static BOOL parse_data_type(struct parser *parser, WCHAR **line)
DWORD val; DWORD val;
/* "hex(xx):" is special */ /* "hex(xx):" is special */
val = strtoulW(*line, &end, 16); val = wcstoul(*line, &end, 16);
if (!**line || *end != ')' || *(end + 1) != ':') if (!**line || *end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE))
return FALSE; return FALSE;
parser->data_type = val; parser->data_type = val;
......
...@@ -464,7 +464,7 @@ static void test_basic_import(void) ...@@ -464,7 +464,7 @@ static void test_basic_import(void)
verify_reg(hkey, "Wine13f", 0xffff, "Value", 6, 0); verify_reg(hkey, "Wine13f", 0xffff, "Value", 6, 0);
verify_reg(hkey, "Wine13g", 0x7fffffff, "Value", 6, 0); verify_reg(hkey, "Wine13g", 0x7fffffff, "Value", 6, 0);
verify_reg(hkey, "Wine13h", 0xffffffff, "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); RegCloseKey(hkey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment