diff options
author | teor <teor2345@gmail.com> | 2017-10-15 16:45:15 -0400 |
---|---|---|
committer | teor <teor2345@gmail.com> | 2017-10-15 16:48:36 -0400 |
commit | 5bca66be497f18b94a85ad8eb836fff5a356627d (patch) | |
tree | bbc32c78c50c32892c504e4b77ea6a5e0b0c6b5a /src/or/nodelist.c | |
parent | 43ebe54a24d3210ef037f7e2b67fad9597361bab (diff) | |
download | tor-5bca66be497f18b94a85ad8eb836fff5a356627d.tar.gz tor-5bca66be497f18b94a85ad8eb836fff5a356627d.zip |
Clear the address when node_get_prim_orport() returns early
Fixes bug 23874; bugfix on 0.2.8.2-alpha.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r-- | src/or/nodelist.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 070e2e9e0d..0e9a651818 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1031,6 +1031,14 @@ node_get_prim_orport(const node_t *node, tor_addr_port_t *ap_out) node_assert_ok(node); tor_assert(ap_out); + /* Clear the address, as a safety precaution if calling functions ignore the + * return value */ + tor_addr_make_null(&ap_out->addr, AF_INET); + ap_out->port = 0; + + /* Check ri first, because rewrite_node_address_for_bridge() updates + * node->ri with the configured bridge address. */ + RETURN_IPV4_AP(node->ri, or_port, ap_out); RETURN_IPV4_AP(node->rs, or_port, ap_out); /* Microdescriptors only have an IPv6 address */ |