summaryrefslogtreecommitdiff
path: root/src/or/nodelist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-04-17 19:41:51 -0400
committerNick Mathewson <nickm@torproject.org>2018-04-17 19:43:14 -0400
commit1abe0a5769f3fe7c2a36975acd8ab1e861925f51 (patch)
treee1839e90b4cbab9d96f42c9089ec424412db2715 /src/or/nodelist.c
parent31a450a5b69a88fd9f38b1ca043952009ffddbf7 (diff)
downloadtor-1abe0a5769f3fe7c2a36975acd8ab1e861925f51.tar.gz
tor-1abe0a5769f3fe7c2a36975acd8ab1e861925f51.zip
Add an initialization case to node_get_prim_dirport
Fixes a bug found by scan-build; bugfix on c2fa743806acc. Bug not in any released Tor.
Diffstat (limited to 'src/or/nodelist.c')
-rw-r--r--src/or/nodelist.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 81a5c944ac..bbcfb6cfff 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1583,6 +1583,11 @@ node_get_prim_dirport(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. */