diff options
author | Peter Palfrader <peter@palfrader.org> | 2008-08-13 12:45:53 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2008-08-13 12:45:53 +0000 |
commit | 8ef2fe4b3722016a1f801a6d0fdc6dd81715baab (patch) | |
tree | ec45308c96b0f1fdd1d9286f823cab4b55b318b6 /src/or/policies.c | |
parent | 4a74b9a7df00b4883464a53da055ba61afa72446 (diff) | |
download | tor-8ef2fe4b3722016a1f801a6d0fdc6dd81715baab.tar.gz tor-8ef2fe4b3722016a1f801a6d0fdc6dd81715baab.zip |
Return NULL for policies that do not allow any exits
svn:r16525
Diffstat (limited to 'src/or/policies.c')
-rw-r--r-- | src/or/policies.c | 5 |
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); |