diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-10-04 23:51:30 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-10-04 23:51:30 -0400 |
commit | 4080d9b0fa9dd4cab903599d6f7f3ed0785e2420 (patch) | |
tree | 54fe163d4141fd910a3b3cd73b08ffc528fdd053 /src/or/routerlist.c | |
parent | 9edd85aa4cb019499294b4c378961be8e42bcefe (diff) | |
download | tor-4080d9b0fa9dd4cab903599d6f7f3ed0785e2420.tar.gz tor-4080d9b0fa9dd4cab903599d6f7f3ed0785e2420.zip |
Fix a couple more node_t-related nullpointer bugs
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 05ecbe32b4..2849f17ea7 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1321,9 +1321,13 @@ nodelist_add_node_family(smartlist_t *sl, const node_t *node) { /* XXXX MOVE */ 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(); + tor_assert(node); + + declared_family = node_get_declared_family(node); + /* First, add any nodes with similar network addresses. */ if (options->EnforceDistinctSubnets) { 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); if (addrs_in_same_network_family(&a, &node_addr)) 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 @@ -1349,12 +1353,12 @@ nodelist_add_node_family(smartlist_t *sl, const node_t *node) continue; if (!(family2 = node_get_declared_family(node2))) continue; - SMARTLIST_FOREACH(family2, const char *, name2, { + SMARTLIST_FOREACH_BEGIN(family2, const char *, name2) { if (node_nickname_matches(node, name2)) { smartlist_add(sl, (void*)node2); break; } - }); + } SMARTLIST_FOREACH_END(name2); } SMARTLIST_FOREACH_END(name); } |