Sfoglia il codice sorgente

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 16 anni fa
parent
commit
f1b7295b27
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  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));