mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
fix an edge case in parsing config options (thanks weasel)
svn:r3486
This commit is contained in:
+4
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user