https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0a5bdf825b7345410ce4f…
commit 0a5bdf825b7345410ce4f0236cf92ac2bd2af08c
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:06:05 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:32 2022 +0200
[WINESYNC] reg: Abort 'add' operation when parsing command-line arguments that
are not switches.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id b2ead1ffcc8d28b488b561e8c5a9e3cc964699a3 by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
base/applications/cmdutils/reg/add.c | 74 ++++++++++++++++++------------------
sdk/tools/winesync/reg.cfg | 2 +-
2 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/base/applications/cmdutils/reg/add.c b/base/applications/cmdutils/reg/add.c
index e1fd2223716..f259f0a4100 100644
--- a/base/applications/cmdutils/reg/add.c
+++ b/base/applications/cmdutils/reg/add.c
@@ -222,46 +222,48 @@ int reg_add(int argc, WCHAR *argvW[])
for (i = 3; i < argc; i++)
{
- if (argvW[i][0] == '/' || argvW[i][0] == '-')
+ WCHAR *str;
+
+ if (argvW[i][0] != '/' && argvW[i][0] != '-')
+ goto invalid;
+
+ str = &argvW[i][1];
+
+ if (!lstrcmpiW(str, L"ve"))
{
- WCHAR *str = &argvW[i][1];
+ if (value_empty) goto invalid;
+ value_empty = TRUE;
+ continue;
+ }
+ else if (!str[0] || str[1])
+ goto invalid;
- if (!lstrcmpiW(str, L"ve"))
- {
- if (value_empty) goto invalid;
- value_empty = TRUE;
- continue;
- }
- else if (!str[0] || str[1])
+ switch (towlower(*str))
+ {
+ case 'v':
+ if (value_name || !(value_name = argvW[++i]))
goto invalid;
-
- switch (towlower(*str))
- {
- case 'v':
- if (value_name || !(value_name = argvW[++i]))
- goto invalid;
- break;
- case 't':
- if (type || !(type = argvW[++i]))
- goto invalid;
- break;
- case 'd':
- if (data || !(data = argvW[++i]))
- goto invalid;
- break;
- case 's':
- str = argvW[++i];
- if (separator || !str || lstrlenW(str) != 1)
- goto invalid;
- separator = str[0];
- break;
- case 'f':
- if (force) goto invalid;
- force = TRUE;
- break;
- default:
+ break;
+ case 't':
+ if (type || !(type = argvW[++i]))
goto invalid;
- }
+ break;
+ case 'd':
+ if (data || !(data = argvW[++i]))
+ goto invalid;
+ break;
+ case 's':
+ str = argvW[++i];
+ if (separator || !str || lstrlenW(str) != 1)
+ goto invalid;
+ separator = str[0];
+ break;
+ case 'f':
+ if (force) goto invalid;
+ force = TRUE;
+ break;
+ default:
+ goto invalid;
}
}
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index c94f10bf936..354fb6013b0 100644
--- a/sdk/tools/winesync/reg.cfg
+++ b/sdk/tools/winesync/reg.cfg
@@ -4,4 +4,4 @@ directories:
files:
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
tags:
- wine: b80da20656feda99f9c6e749f5cd6d6f3c242cd3
+ wine: b2ead1ffcc8d28b488b561e8c5a9e3cc964699a3