]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Clear the address when node_get_prim_orport() returns early
authorteor <teor2345@gmail.com>
Sun, 15 Oct 2017 20:45:15 +0000 (16:45 -0400)
committerteor <teor2345@gmail.com>
Sun, 15 Oct 2017 20:48:36 +0000 (16:48 -0400)
Fixes bug 23874; bugfix on 0.2.8.2-alpha.

changes/bug23874 [new file with mode: 0644]
src/or/nodelist.c

diff --git a/changes/bug23874 b/changes/bug23874
new file mode 100644 (file)
index 0000000..bf66205
--- /dev/null
@@ -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.
index 070e2e9e0d9103e14577aefa7da1e042fda44044..0e9a65181833a90d920c0b30c3fdd3f22deef2a9 100644 (file)
@@ -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 */