diff options
author | Roger Dingledine <arma@torproject.org> | 2005-02-01 00:05:57 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-02-01 00:05:57 +0000 |
commit | e7e77d6d8e6bdbd77f74021917d612b514cc8fcf (patch) | |
tree | ab67176886a1523d1f76669c90f32736e0895941 /src/or/config.c | |
parent | d19aaa9a464f77d6d6bd7a409f8cb462383c85a0 (diff) | |
download | tor-e7e77d6d8e6bdbd77f74021917d612b514cc8fcf.tar.gz tor-e7e77d6d8e6bdbd77f74021917d612b514cc8fcf.zip |
fix an edge case in parsing config options (thanks weasel)
svn:r3486
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | 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 33f0e023d3..c6b3cb6821 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -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); |