[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Disallow command line keywords with more than two dashes as prefix.



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Tue, 27 Oct 2009 17:50:24 +0100
Subject: Disallow command line keywords with more than two dashes as prefix.
Commit: f1b7295b27ba1f472304f2931bb23df6884b64e6

This might help fix cid 422, where coverity fails to notice that
argv strings are null-escaped.
---
 src/or/config.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 5a0ced2..1b415ee 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));
-- 
1.5.6.5