Commit 2c7d7459 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

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

parent 51e83dec
...@@ -334,32 +334,34 @@ int reg_query(int argc, WCHAR *argvW[]) ...@@ -334,32 +334,34 @@ int reg_query(int argc, WCHAR *argvW[])
for (i = 3; i < argc; i++) for (i = 3; i < argc; i++)
{ {
if (argvW[i][0] == '/' || argvW[i][0] == '-') WCHAR *str;
{
WCHAR *str = &argvW[i][1];
if (!lstrcmpiW(str, L"ve")) if (argvW[i][0] != '/' && argvW[i][0] != '-')
{ goto invalid;
if (value_empty) goto invalid;
value_empty = TRUE;
continue;
}
else if (!str[0] || str[1])
goto invalid;
switch (towlower(*str)) str = &argvW[i][1];
{
case 'v': if (!lstrcmpiW(str, L"ve"))
if (value_name || !(value_name = argvW[++i])) {
goto invalid; if (value_empty) goto invalid;
break; value_empty = TRUE;
case 's': continue;
if (recurse) goto invalid; }
recurse = TRUE; else if (!str[0] || str[1])
break; goto invalid;
default:
switch (towlower(*str))
{
case 'v':
if (value_name || !(value_name = argvW[++i]))
goto invalid; goto invalid;
} break;
case 's':
if (recurse) goto invalid;
recurse = 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