diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-04 20:23:38 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-04 20:23:38 -0500 |
commit | 333d5d0f2afb4023d9763ec8ce28f973cbecc591 (patch) | |
tree | bff1c8bef198d51f87cdf5c8eb0fe2c231987f68 | |
parent | 528dcd113c5105120d3697ced74dcbe8b95b9774 (diff) | |
parent | 4b5cdb2c3060eefcc616764845a4ed7c002117b7 (diff) | |
download | tor-333d5d0f2afb4023d9763ec8ce28f973cbecc591.tar.gz tor-333d5d0f2afb4023d9763ec8ce28f973cbecc591.zip |
Merge remote-tracking branch 'teor/bug21576_029_v2' into maint-0.3.0
-rw-r--r-- | changes/bug21576 | 4 | ||||
-rw-r--r-- | src/or/connection_edge.c | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/changes/bug21576 b/changes/bug21576 new file mode 100644 index 0000000000..68d8471192 --- /dev/null +++ b/changes/bug21576 @@ -0,0 +1,4 @@ + o Major bugfixes (crash, directory connections): + - Fix a rare crash when sending a begin cell on a circuit whose linked + directory connection has already been closed. Fixes bug 21576; + bugfix on Tor 0.2.9.3-alpha. Reported by alecmuffett. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index ef551048b8..dac0c01012 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2514,10 +2514,16 @@ connection_ap_handshake_send_begin(entry_connection_t *ap_conn) } else if (begin_type == RELAY_COMMAND_BEGIN_DIR) { /* This connection is a begindir directory connection. * Look at the linked directory connection to access the directory purpose. - * (This must be non-NULL, because we're doing begindir.) */ - tor_assert(base_conn->linked); + * If a BEGINDIR connection is ever not linked, that's a bug. */ + if (BUG(!base_conn->linked)) { + return -1; + } connection_t *linked_dir_conn_base = base_conn->linked_conn; - tor_assert(linked_dir_conn_base); + /* If the linked connection has been unlinked by other code, we can't send + * a begin cell on it. */ + if (!linked_dir_conn_base) { + return -1; + } /* Sensitive directory connections must have an anonymous path length. * Otherwise, directory connections are typically one-hop. * This matches the earlier check for directory connection path anonymity |