aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-23 15:55:48 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-23 15:55:48 -0400
commitf7707c9031381cf3ceb663d3bc3a9c81e346a90d (patch)
treea509aa9b4acca8d896d843e56bcd52e373282877
parent880d596f4dbb65885ebbc8b1b88e852529779324 (diff)
parentb1d6cf2508e57c98017412446024c9dd6587fe63 (diff)
downloadtor-f7707c9031381cf3ceb663d3bc3a9c81e346a90d.tar.gz
tor-f7707c9031381cf3ceb663d3bc3a9c81e346a90d.zip
Merge branch 'maint-0.3.2'
-rw-r--r--changes/bug238743
-rw-r--r--src/or/nodelist.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/changes/bug23874 b/changes/bug23874
new file mode 100644
index 0000000000..bf6620553d
--- /dev/null
+++ 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
index eae74e18b5..0743be1802 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1435,6 +1435,11 @@ 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. */