summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-12-08 16:54:18 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2020-12-08 16:54:18 +0200
commitf280c171e261dfe6fe9f39f715b4a40254982d58 (patch)
treec97e61d30d510fc0f95a70e1e623eff738a93f44 /src/app
parent2d0a7f2e8922fd47e0fe613ea08dcf1ce3840e73 (diff)
parent558aaf1c32ece99f62006c6a3395c3e53d5e414d (diff)
downloadtor-f280c171e261dfe6fe9f39f715b4a40254982d58.tar.gz
tor-f280c171e261dfe6fe9f39f715b4a40254982d58.zip
Merge branch 'mr/233'
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 0c3b6a61a3..f946df7180 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -2601,8 +2601,11 @@ config_parse_commandline(int argc, char **argv, int ignore_errors)
parsed_cmdline_free(result);
return NULL;
}
- } else if (want_arg == ARGUMENT_OPTIONAL && is_last) {
+ } else if (want_arg == ARGUMENT_OPTIONAL &&
+ /* optional arguments may never start with '-'. */
+ (is_last || argv[i+1][0] == '-')) {
arg = tor_strdup("");
+ want_arg = ARGUMENT_NONE; // prevent skipping the next flag.
} else {
arg = (want_arg != ARGUMENT_NONE) ? tor_strdup(argv[i+1]) :
tor_strdup("");