[PATCH 1/3] reg: Fail if /s is used without an accompanying argument

Hugh McMaster hugh.mcmaster at outlook.com
Wed Feb 17 06:41:05 CST 2016


Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
 programs/reg/reg.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index ef25fe5..bcd812a 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -576,7 +576,16 @@ int wmain(int argc, WCHAR *argvW[])
             else if (!lstrcmpiW(argvW[i], slashTW))
                 type = argvW[++i];
             else if (!lstrcmpiW(argvW[i], slashSW))
-                separator = argvW[++i][0];
+            {
+                WCHAR *ptr = argvW[++i];
+
+                if (!ptr)
+                {
+                    output_message(STRING_INVALID_CMDLINE);
+                    return 1;
+                }
+                separator = ptr[0];
+            }
             else if (!lstrcmpiW(argvW[i], slashDW))
             {
                 if (!(data = argvW[++i]))
-- 
1.9.1




More information about the wine-patches mailing list