]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix an edge case in parsing config options (thanks weasel)
authorRoger Dingledine <arma@torproject.org>
Tue, 1 Feb 2005 00:05:57 +0000 (00:05 +0000)
committerRoger Dingledine <arma@torproject.org>
Tue, 1 Feb 2005 00:05:57 +0000 (00:05 +0000)
svn:r3486

src/or/config.c

index 33f0e023d39a61b38e8439b74ca50419f23158a3..c6b3cb6821347919a6b63d158697caad1b2ade63 100644 (file)
@@ -508,6 +508,9 @@ config_free_lines(struct config_line_t *front)
 static config_var_t *config_find_option(const char *key)
 {
   int i;
+  size_t keylen = strlen(key);
+  if(!keylen)
+    return NULL; /* if they say "--" on the commandline, it's not an option */
   /* First, check for an exact (case-insensitive) match */
   for (i=0; config_vars[i].name; ++i) {
     if (!strcasecmp(key, config_vars[i].name))
@@ -515,7 +518,7 @@ static config_var_t *config_find_option(const char *key)
   }
   /* If none, check for an abbreviated match */
   for (i=0; config_vars[i].name; ++i) {
-    if (!strncasecmp(key, config_vars[i].name, strlen(key))) {
+    if (!strncasecmp(key, config_vars[i].name, keylen)) {
       log_fn(LOG_WARN, "The abbreviation '%s' is deprecated. "
           "Tell Nick and Roger to make it official, or just use '%s' instead",
              key, config_vars[i].name);