aboutsummaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index ac7ecbaf0b..9489eef48a 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -1085,6 +1085,8 @@ policy_summary_add_item(smartlist_t *summary, addr_policy_t *p)
/** 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 @@ policy_summarize(smartlist_t *policy)
/* 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);