summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-02-03 10:14:25 -0500
committerNick Mathewson <nickm@torproject.org>2017-02-03 10:35:07 -0500
commit19e25d5cabd23f28044ccbddc01e5cacbde2cfcb (patch)
tree5c7d209abd9dc33ab61990e05c783940e623dcd1 /src/or/control.c
parent9d5a9feb404c61d93309eea1c68fcae3ff0cf8f3 (diff)
downloadtor-19e25d5cabd23f28044ccbddc01e5cacbde2cfcb.tar.gz
tor-19e25d5cabd23f28044ccbddc01e5cacbde2cfcb.zip
Prevention: never die from extend_info_from_node() failure.
Bug 21242 occurred because we asserted that extend_info_from_node() had succeeded...even though we already had the code to handle such a failure. We fixed that in 93b39c51629ed0ded2bf807cb6. But there were four other cases in our code where we called extend_info_from_node() and either tor_assert()ed that it returned non-NULL, or [in one case] silently assumed that it returned non-NULL. That's not such a great idea. This patch makes those cases check for a bug of this kind instead. Fixes bug 21372; bugfix on 0.2.3.1-alpha when extend_info_from_node() was introduced.
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 2c71ea5bb9..b0a687679d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3377,7 +3377,8 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
SMARTLIST_FOREACH(nodes, const node_t *, node,
{
extend_info_t *info = extend_info_from_node(node, first_node);
- if (first_node && !info) {
+ if (!info) {
+ tor_assert_nonfatal(first_node);
log_warn(LD_CONTROL,
"controller tried to connect to a node that doesn't have any "
"addresses that are allowed by the firewall configuration; "
@@ -3385,10 +3386,6 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len,
circuit_mark_for_close(TO_CIRCUIT(circ), -END_CIRC_REASON_CONNECTFAILED);
connection_write_str_to_buf("551 Couldn't start circuit\r\n", conn);
goto done;
- } else {
- /* True, since node_has_descriptor(node) == true and we are extending
- * to the node's primary address */
- tor_assert(info);
}
circuit_append_new_exit(circ, info);
extend_info_free(info);