reg: Fail if the data for REG_MULTI_SZ begins with a separator.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2016-02-29 15:54:22 +11:00 committed by Alexandre Julliard
parent afa5251b10
commit a573f237d0
2 changed files with 3 additions and 3 deletions

View File

@ -300,7 +300,7 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r
else
buffer[destindex] = data[i];
if (destindex && !buffer[destindex - 1] && !buffer[destindex])
if (destindex && !buffer[destindex - 1] && (!buffer[destindex] || destindex == 1))
{
HeapFree(GetProcessHeap(), 0, buffer);
output_message(STRING_INVALID_STRING);

View File

@ -357,7 +357,7 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r);
ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
@ -371,7 +371,7 @@ static void test_add(void)
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi14 /t REG_MULTI_SZ /d \"\\0a\" /f", &r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);