Hugh McMaster : reg: Abort 'query' operation when parsing command-line arguments that are not switches.
Alexandre Julliard
julliard at winehq.org
Fri Apr 2 16:10:12 CDT 2021
Module: wine
Branch: master
Commit: 2c7d74594f2bd421f6d904f334171a198a13c66e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2c7d74594f2bd421f6d904f334171a198a13c66e
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Fri Apr 2 22:26:55 2021 +1100
reg: Abort 'query' operation when parsing command-line arguments that are not switches.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/query.c | 48 +++++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/programs/reg/query.c b/programs/reg/query.c
index 656ac875ec4..cc8f264e780 100644
--- a/programs/reg/query.c
+++ b/programs/reg/query.c
@@ -334,32 +334,34 @@ int reg_query(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"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 's':
- if (recurse) goto invalid;
- recurse = TRUE;
- break;
- default:
+ str = &argvW[i][1];
+
+ 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 's':
+ if (recurse) goto invalid;
+ recurse = TRUE;
+ break;
+ default:
+ goto invalid;
}
}
More information about the wine-cvs
mailing list