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

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-06-21 12:18:53 +00:00 committed by Alexandre Julliard
parent c0312bf79e
commit 8803b9616b
2 changed files with 4 additions and 3 deletions

View File

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

View File

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