diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-03-17 20:26:00 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-03-17 20:26:00 +0000 |
commit | 5109f64107b1ca1c45da0d01494d9b818c3d5340 (patch) | |
tree | d69c37f40497fc5da861e68e0650d851e561924f /src | |
parent | 5e63abc20bd9e66facb53af9d13c4317be35a6a8 (diff) | |
download | tor-5109f64107b1ca1c45da0d01494d9b818c3d5340.tar.gz tor-5109f64107b1ca1c45da0d01494d9b818c3d5340.zip |
r18898@catbus: nickm | 2008-03-17 16:25:58 -0400
Partial backport: Fix bug in earlier bugfix. Disallow empty exit policies in router descriptors.
svn:r14083
Diffstat (limited to 'src')
-rw-r--r-- | src/or/policies.c | 5 | ||||
-rw-r--r-- | src/or/routerparse.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index 20c1fb9186..a3af3c9522 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -530,10 +530,7 @@ compare_addr_to_addr_policy(uint32_t addr, uint16_t port, int match = 0; int maybe = 0; int i, len; - if (!policy) - return ADDR_POLICY_REJECTED; - - len = smartlist_len(policy); + len = policy ? smartlist_len(policy) : 0; for (i = 0; i < len; ++i) { addr_policy_t *tmpe = smartlist_get(policy, i); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 1b77d992a3..31b10baf30 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1272,6 +1272,10 @@ router_parse_entry_from_string(const char *s, const char *end, } exit_policy_tokens = find_all_exitpolicy(tokens); + if (!smartlist_len(exit_policy_tokens)) { + log_warn(LD_DIR, "No exit policy tokens in descriptor."); + goto err; + } SMARTLIST_FOREACH(exit_policy_tokens, directory_token_t *, t, if (router_add_exit_policy(router,t)<0) { log_warn(LD_DIR,"Error in exit policy"); |