mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Fix a couple more node_t-related nullpointer bugs
This commit is contained in:
parent
9edd85aa4c
commit
4080d9b0fa
@ -1313,7 +1313,7 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn,
|
|||||||
const node_t *r;
|
const node_t *r;
|
||||||
int opt = conn->chosen_exit_optional;
|
int opt = conn->chosen_exit_optional;
|
||||||
r = node_get_by_nickname(conn->chosen_exit_name, 1);
|
r = node_get_by_nickname(conn->chosen_exit_name, 1);
|
||||||
if (r) {
|
if (r && node_has_descriptor(r)) {
|
||||||
extend_info = extend_info_from_node(r);
|
extend_info = extend_info_from_node(r);
|
||||||
} else {
|
} else {
|
||||||
log_debug(LD_DIR, "considering %d, %s",
|
log_debug(LD_DIR, "considering %d, %s",
|
||||||
|
@ -514,6 +514,7 @@ node_get_by_nickname(const char *nickname, int warn_if_unnamed)
|
|||||||
const char *
|
const char *
|
||||||
node_get_nickname(const node_t *node)
|
node_get_nickname(const node_t *node)
|
||||||
{
|
{
|
||||||
|
tor_assert(node);
|
||||||
if (node->rs)
|
if (node->rs)
|
||||||
return node->rs->nickname;
|
return node->rs->nickname;
|
||||||
else if (node->ri)
|
else if (node->ri)
|
||||||
|
@ -1321,9 +1321,13 @@ nodelist_add_node_family(smartlist_t *sl, const node_t *node)
|
|||||||
{
|
{
|
||||||
/* XXXX MOVE */
|
/* XXXX MOVE */
|
||||||
const smartlist_t *all_nodes = nodelist_get_list();
|
const smartlist_t *all_nodes = nodelist_get_list();
|
||||||
const smartlist_t *declared_family = node_get_declared_family(node);
|
const smartlist_t *declared_family;
|
||||||
or_options_t *options = get_options();
|
or_options_t *options = get_options();
|
||||||
|
|
||||||
|
tor_assert(node);
|
||||||
|
|
||||||
|
declared_family = node_get_declared_family(node);
|
||||||
|
|
||||||
/* First, add any nodes with similar network addresses. */
|
/* First, add any nodes with similar network addresses. */
|
||||||
if (options->EnforceDistinctSubnets) {
|
if (options->EnforceDistinctSubnets) {
|
||||||
tor_addr_t node_addr;
|
tor_addr_t node_addr;
|
||||||
@ -1334,7 +1338,7 @@ nodelist_add_node_family(smartlist_t *sl, const node_t *node)
|
|||||||
node_get_addr(node2, &a);
|
node_get_addr(node2, &a);
|
||||||
if (addrs_in_same_network_family(&a, &node_addr))
|
if (addrs_in_same_network_family(&a, &node_addr))
|
||||||
smartlist_add(sl, (void*)node2);
|
smartlist_add(sl, (void*)node2);
|
||||||
} SMARTLIST_FOREACH_END(node);
|
} SMARTLIST_FOREACH_END(node2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now, add all nodes in the declared_family of this node, if they
|
/* Now, add all nodes in the declared_family of this node, if they
|
||||||
@ -1349,12 +1353,12 @@ nodelist_add_node_family(smartlist_t *sl, const node_t *node)
|
|||||||
continue;
|
continue;
|
||||||
if (!(family2 = node_get_declared_family(node2)))
|
if (!(family2 = node_get_declared_family(node2)))
|
||||||
continue;
|
continue;
|
||||||
SMARTLIST_FOREACH(family2, const char *, name2, {
|
SMARTLIST_FOREACH_BEGIN(family2, const char *, name2) {
|
||||||
if (node_nickname_matches(node, name2)) {
|
if (node_nickname_matches(node, name2)) {
|
||||||
smartlist_add(sl, (void*)node2);
|
smartlist_add(sl, (void*)node2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
} SMARTLIST_FOREACH_END(name2);
|
||||||
} SMARTLIST_FOREACH_END(name);
|
} SMARTLIST_FOREACH_END(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user