Commit 51e83dec authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Abort 'delete' operation when parsing command-line arguments that are not switches.

parent b2ead1ff
......@@ -118,38 +118,40 @@ int reg_delete(int argc, WCHAR *argvW[])
for (i = 3; i < argc; i++)
{
if (argvW[i][0] == '/' || argvW[i][0] == '-')
{
WCHAR *str = &argvW[i][1];
WCHAR *str;
if (!lstrcmpiW(str, L"va"))
{
if (value_all) goto invalid;
value_all = TRUE;
continue;
}
else if (!lstrcmpiW(str, L"ve"))
{
if (value_empty) goto invalid;
value_empty = TRUE;
continue;
}
else if (!str[0] || str[1])
goto invalid;
if (argvW[i][0] != '/' && argvW[i][0] != '-')
goto invalid;
switch (towlower(*str))
{
case 'v':
if (value_name || !(value_name = argvW[++i]))
goto invalid;
break;
case 'f':
if (force) goto invalid;
force = TRUE;
break;
default:
str = &argvW[i][1];
if (!lstrcmpiW(str, L"va"))
{
if (value_all) goto invalid;
value_all = TRUE;
continue;
}
else if (!lstrcmpiW(str, L"ve"))
{
if (value_empty) goto invalid;
value_empty = TRUE;
continue;
}
else if (!str[0] || str[1])
goto invalid;
switch (towlower(*str))
{
case 'v':
if (value_name || !(value_name = argvW[++i]))
goto invalid;
}
break;
case 'f':
if (force) goto invalid;
force = TRUE;
break;
default:
goto invalid;
}
}
......
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