reg: Add a check for multiple backslashes at the end of the key.

This commit is contained in:
Jonathan Vollebregt 2015-02-19 13:19:11 +01:00 committed by Alexandre Julliard
parent 208ca071dc
commit 513505d6c4
2 changed files with 10 additions and 2 deletions

View File

@ -181,6 +181,14 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r
static BOOL sane_path(const WCHAR *key)
{
unsigned int i = strlenW(key);
if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\'))
{
reg_message(STRING_INVALID_KEY);
return FALSE;
}
if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\')
{
reg_message(STRING_NO_REMOTE);

View File

@ -129,10 +129,10 @@ static void test_add(void)
ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /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 %u\n", r);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2");
todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */),
ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */),
"got exit code %d\n", r);
run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r);