Browse Source

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.
Sebastian Hahn 15 years ago
parent
commit
f1b7295b27
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/or/config.c

+ 4 - 1
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));