From 9558fcc012c47d1570b34ad154ac1249779b2e8c Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 19 Mar 2017 15:27:43 +0100 Subject: [PATCH] Reset optind and optopt for second getopt loop --- src/user_options.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/user_options.c b/src/user_options.c index 4b4a7b9b6..dc838247e 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -281,6 +281,16 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) } } + if (optopt != 0) + { + event_log_error (hashcat_ctx, "Invalid argument specified"); + + return -1; + } + + optind = 1; + optopt = 0; + option_index = 0; while (((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1) && optopt == 0)