aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-08 10:11:57 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-08 10:11:57 -0400
commitdd63033fcbb960ac563a8f417a7f65e62781d9a9 (patch)
tree38faf7ea5111a0b8ae2a5fc1463102ed7751358b /src/or
parent3f3739c6e064fd5e1c2ac89bfd49fed7a622ac68 (diff)
parent1ef8023e000d9136b7069515f9d7303810a8f3b2 (diff)
downloadtor-dd63033fcbb960ac563a8f417a7f65e62781d9a9.tar.gz
tor-dd63033fcbb960ac563a8f417a7f65e62781d9a9.zip
Merge branch 'maint-0.3.1' into maint-0.3.2
Diffstat (limited to 'src/or')
-rw-r--r--src/or/protover.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/protover.c b/src/or/protover.c
index 45f0377d61..e8524a25b5 100644
--- a/src/or/protover.c
+++ b/src/or/protover.c
@@ -453,6 +453,10 @@ cmp_single_ent_by_version(const void **a_, const void **b_)
static char *
contract_protocol_list(const smartlist_t *proto_strings)
{
+ if (smartlist_len(proto_strings) == 0) {
+ return tor_strdup("");
+ }
+
// map from name to list of single-version entries
strmap_t *entry_lists_by_name = strmap_new();
// list of protocol names
@@ -561,6 +565,10 @@ char *
protover_compute_vote(const smartlist_t *list_of_proto_strings,
int threshold)
{
+ if (smartlist_len(list_of_proto_strings) == 0) {
+ return tor_strdup("");
+ }
+
smartlist_t *all_entries = smartlist_new();
// First, parse the inputs and break them into singleton entries.
@@ -587,6 +595,11 @@ protover_compute_vote(const smartlist_t *list_of_proto_strings,
smartlist_free(unexpanded);
} SMARTLIST_FOREACH_END(vote);
+ if (smartlist_len(all_entries) == 0) {
+ smartlist_free(all_entries);
+ return tor_strdup("");
+ }
+
// Now sort the singleton entries
smartlist_sort_strings(all_entries);