tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit b1bd1bf19f7e17a94cefaccb63e5608fda1df4e2
parent fcd5c3144a44f4081e9e7c4336b932e31ae45f77
Author: Nick Mathewson <nickm@torproject.org>
Date:   Mon, 23 Oct 2017 15:53:45 -0400

Merge remote-tracking branch 'teor/bug23874-029' into maint-0.2.9

Diffstat:
Achanges/bug23874 | 3+++
Msrc/or/nodelist.c | 8++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/changes/bug23874 b/changes/bug23874 @@ -0,0 +1,3 @@ + o Minor bugfixes (memory safety): + - Clear the address when node_get_prim_orport() returns early. + Fixes bug 23874; bugfix on 0.2.8.2-alpha. diff --git 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 */