[or-cvs] r16525: {tor} Return NULL for policies that do not allow any exits (tor/trunk/src/or)

weasel at seul.org weasel at seul.org
Wed Aug 13 12:45:54 UTC 2008


Author: weasel
Date: 2008-08-13 08:45:53 -0400 (Wed, 13 Aug 2008)
New Revision: 16525

Modified:
   tor/trunk/src/or/policies.c
Log:
Return NULL for policies that do not allow any exits

Modified: tor/trunk/src/or/policies.c
===================================================================
--- tor/trunk/src/or/policies.c	2008-08-13 12:45:44 UTC (rev 16524)
+++ tor/trunk/src/or/policies.c	2008-08-13 12:45:53 UTC (rev 16525)
@@ -1085,6 +1085,8 @@
 /** Create a string representing a summary for an exit policy.
  * The summary will either be an "accept" plus a comma-seperated list of port
  * ranges or a "reject" plus portranges, depending on which is shorter.
+ *
+ * If no exits are allowed at all then NULL is returned.
  */
 char *
 policy_summarize(smartlist_t *policy)
@@ -1139,6 +1141,9 @@
   /* Figure out which of the two stringlists will be shorter and use
    * that to build the result
    */
+  if (smartlist_len(accepts) == 0) /* no exits at all */
+    return NULL;
+
   accepts_str = smartlist_join_strings(accepts, ",", 0, &accepts_len);
   rejects_str = smartlist_join_strings(rejects, ",", 0, &rejects_len);
 



More information about the tor-commits mailing list