[PATCH 2/7] reg: Fail if REG_DWORD is passed with no data argument
Hugh McMaster
hugh.mcmaster at outlook.com
Sun Feb 14 18:38:32 CST 2016
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/reg/reg.c | 6 ++++++
programs/reg/tests/reg.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index cc8cac2..e4289f3 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -366,6 +366,12 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty,
output_message(STRING_UNSUPPORTED_TYPE, type);
return 1;
}
+ if (reg_type == REG_DWORD && !data)
+ {
+ RegCloseKey(subkey);
+ output_message(STRING_INVALID_CMDLINE);
+ return 1;
+ }
if (data)
reg_data = get_regdata(data,reg_type,separator,®_count);
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index cdf8359..4534f7d 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -257,7 +257,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword0 /t REG_DWORD /f /d", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r);
- todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
+ ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
--
1.9.1
More information about the wine-patches
mailing list