aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-09-04 11:28:21 -0400
committerNick Mathewson <nickm@torproject.org>2019-09-04 11:28:21 -0400
commit870874fec8cadf3a3e91f63cd7f25757b1ec8b8a (patch)
treef368aaef7fb473d3a2c579a112e9320a4c71cf65 /src/app
parent34f3fcef408a91275561e86afc3bd1d2da3b0375 (diff)
downloadtor-870874fec8cadf3a3e91f63cd7f25757b1ec8b8a.tar.gz
tor-870874fec8cadf3a3e91f63cd7f25757b1ec8b8a.zip
config: Make CLEAR with a nonempty value into a nonfatal assertion.
When we parse a CLEAR line (e.g., "/OrPort" or /OrPort blah blah"), we always suppress the value, even if one exists. That means that the block of code was meant to handle CLEAR lines didn't actually do anything, since we previously handled them the same way as with other empty values. Closes ticket 31529.
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/confparse.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c
index f20a361ba3..ecc4e86560 100644
--- a/src/app/config/confparse.c
+++ b/src/app/config/confparse.c
@@ -652,9 +652,14 @@ config_assign_line(const config_mgr_t *mgr, void *options,
}
return 0;
} else if (c->command == CONFIG_LINE_CLEAR && !clear_first) {
- // XXXX This is unreachable, since a CLEAR line always has an
- // XXXX empty value.
- config_reset(mgr, options, mvar, use_defaults); // LCOV_EXCL_LINE
+ // This block is unreachable, since a CLEAR line always has an
+ // empty value, and so will trigger be handled by the previous
+ // "if (!strlen(c->value))" block.
+
+ // LCOV_EXCL_START
+ tor_assert_nonfatal_unreached();
+ config_reset(mgr, options, mvar, use_defaults);
+ // LCOV_EXCL_STOP
}
if (options_seen && ! config_var_is_cumulative(cvar)) {