From f1b7295b27ba1f472304f2931bb23df6884b64e6 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Tue, 27 Oct 2009 17:50:24 +0100 Subject: [PATCH] Disallow command line keywords with more than two dashes as prefix. This might help fix cid 422, where coverity fails to notice that argv strings are null-escaped. --- src/or/config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/or/config.c b/src/or/config.c index 5a0ced29d5..1b415ee7a2 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1563,7 +1563,10 @@ config_get_commandlines(int argc, char **argv, config_line_t **result) *new = tor_malloc_zero(sizeof(config_line_t)); s = argv[i]; - while (*s == '-') + /* Each keyword may be prefixed with one or two dashes. */ + if (*s == '-') + s++; + if (*s == '-') s++; (*new)->key = tor_strdup(expand_abbrev(&options_format, s, 1, 1));