]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add an initialization case to node_get_prim_dirport
authorNick Mathewson <nickm@torproject.org>
Tue, 17 Apr 2018 23:41:51 +0000 (19:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 17 Apr 2018 23:43:14 +0000 (19:43 -0400)
Fixes a bug found by scan-build; bugfix on c2fa743806acc. Bug not in
any released Tor.

src/or/nodelist.c

index 81a5c944ace55b00118cdf53265e5c91275c2b83..bbcfb6cffff0d202d5f18d7758e8dc18e32bc2d7 100644 (file)
@@ -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. */