diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-08 10:12:57 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-08 10:12:57 -0400 |
commit | a141127435383840e48e6a06efbfc85eefaf06a8 (patch) | |
tree | 8a2beaf2d8e3c5e84ee4b9a9bd780c5062020f39 /src/or/protover.c | |
parent | f15f90e2cac50154c761da94eb9fd642890f2777 (diff) | |
parent | dd63033fcbb960ac563a8f417a7f65e62781d9a9 (diff) | |
download | tor-a141127435383840e48e6a06efbfc85eefaf06a8.tar.gz tor-a141127435383840e48e6a06efbfc85eefaf06a8.zip |
Merge branch 'maint-0.3.2' into maint-0.3.3
Diffstat (limited to 'src/or/protover.c')
-rw-r--r-- | src/or/protover.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/protover.c b/src/or/protover.c index 674bb1c843..b2ec3372c9 100644 --- a/src/or/protover.c +++ b/src/or/protover.c @@ -529,6 +529,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 @@ -637,6 +641,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. @@ -663,6 +671,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); |