From 323c47532ea7fc79d5e28a0fa58ea0cc4d5196b8 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Fri, 27 Jan 2023 14:31:45 +0100 Subject: APPS/{storeutl,gendsa}: give error on extra arguments, improve doc Point out that options must be given before the final file/URI arg. Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/20156) --- apps/lib/opt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/lib/opt.c b/apps/lib/opt.c index df9152d77b..338a5a8674 100644 --- a/apps/lib/opt.c +++ b/apps/lib/opt.c @@ -1054,8 +1054,13 @@ int opt_check_rest_arg(const char *expected) opt_printf_stderr("%s: Missing argument: %s\n", prog, expected); return 0; } - if (expected != NULL) - return 1; + if (expected != NULL) { + opt = argv[opt_index + 1]; + if (opt == NULL || *opt == '\0') + return 1; + opt_printf_stderr("%s: Extra argument after %s: \"%s\"\n", prog, expected, opt); + return 0; + } if (opt_unknown() == NULL) opt_printf_stderr("%s: Extra option: \"%s\"\n", prog, opt); else -- cgit v1.2.1