[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14083: Partial backport: Fix bug in earlier bugfix. Disallow empty (in tor/branches/tor-0_2_0-patches: . src/or)



Author: nickm
Date: 2008-03-17 16:26:00 -0400 (Mon, 17 Mar 2008)
New Revision: 14083

Modified:
   tor/branches/tor-0_2_0-patches/
   tor/branches/tor-0_2_0-patches/src/or/policies.c
   tor/branches/tor-0_2_0-patches/src/or/routerparse.c
Log:
 r18898@catbus:  nickm | 2008-03-17 16:25:58 -0400
 Partial backport: Fix bug in earlier bugfix.  Disallow empty exit policies in router descriptors.



Property changes on: tor/branches/tor-0_2_0-patches
___________________________________________________________________
 svk:merge ticket from /tor/020 [r18898] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_2_0-patches/src/or/policies.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/policies.c	2008-03-17 20:10:57 UTC (rev 14082)
+++ tor/branches/tor-0_2_0-patches/src/or/policies.c	2008-03-17 20:26:00 UTC (rev 14083)
@@ -530,11 +530,8 @@
   int match = 0;
   int maybe = 0;
   int i, len;
-  if (!policy)
-    return ADDR_POLICY_REJECTED;
+  len = policy ? smartlist_len(policy) : 0;
 
-  len = smartlist_len(policy);
-
   for (i = 0; i < len; ++i) {
     addr_policy_t *tmpe = smartlist_get(policy, i);
     maybe = 0;

Modified: tor/branches/tor-0_2_0-patches/src/or/routerparse.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/routerparse.c	2008-03-17 20:10:57 UTC (rev 14082)
+++ tor/branches/tor-0_2_0-patches/src/or/routerparse.c	2008-03-17 20:26:00 UTC (rev 14083)
@@ -1272,6 +1272,10 @@
   }
 
   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");