[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] fix an edge case in parsing config options (thanks weasel)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] fix an edge case in parsing config options (thanks weasel)
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Mon, 31 Jan 2005 19:05:59 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 31 Jan 2005 19:06:15 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
config.c
Log Message:
fix an edge case in parsing config options (thanks weasel)
Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -d -r1.305 -r1.306
--- config.c 28 Jan 2005 08:53:47 -0000 1.305
+++ config.c 1 Feb 2005 00:05:57 -0000 1.306
@@ -508,6 +508,9 @@
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 @@
}
/* 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);