[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] config: Make CLEAR with a nonempty value into a nonfatal assertion.
commit 870874fec8cadf3a3e91f63cd7f25757b1ec8b8a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Sep 4 11:28:21 2019 -0400
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.
---
changes/ticket31529 | 5 +++++
src/app/config/confparse.c | 11 ++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/changes/ticket31529 b/changes/ticket31529
new file mode 100644
index 000000000..84f982214
--- /dev/null
+++ b/changes/ticket31529
@@ -0,0 +1,5 @@
+ o Minor features (debugging):
+ - Log a nonfatal assertion failure if we encounter a configuration
+ line whose command is "CLEAR" but which has a nonempty value.
+ This should be impossible, according to the rules of our
+ configuration line parsing. Closes ticket 31529.
diff --git a/src/app/config/confparse.c b/src/app/config/confparse.c
index f20a361ba..ecc4e8656 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)) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits