]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Disallow command line keywords with more than two dashes as prefix.
authorSebastian Hahn <sebastian@torproject.org>
Tue, 27 Oct 2009 16:50:24 +0000 (17:50 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 27 Oct 2009 16:50:24 +0000 (17:50 +0100)
This might help fix cid 422, where coverity fails to notice that
argv strings are null-escaped.

src/or/config.c

index 5a0ced29d57ed962677aef81721cb7691c8e6e55..1b415ee7a2320958cb0ead3f6974dd4618d7a68d 100644 (file)
@@ -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));