aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/dont_segfault_while_making_consensus_without_params5
-rw-r--r--src/or/dirvote.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/changes/dont_segfault_while_making_consensus_without_params b/changes/dont_segfault_while_making_consensus_without_params
new file mode 100644
index 000000000..e0bcd4086
--- /dev/null
+++ b/changes/dont_segfault_while_making_consensus_without_params
@@ -0,0 +1,5 @@
+ o Minor bugfixes:
+ - When none of the authorities vote on any params, Tor segfaults when
+ trying to make the consensus from the votes. This is currently
+ not critical, because authorities do include params in their votes.
+ Bugfix on 0.2.2.10-alpha, fixes bug 1322.
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index ecf236e8f..30e340c73 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -1757,10 +1757,12 @@ networkstatus_compute_consensus(smartlist_t *votes,
// Parse params, extract BW_WEIGHT_SCALE if present
// DO NOT use consensus_param_bw_weight_scale() in this code!
// The consensus is not formed yet!
- if (strcmpstart(params, "bwweightscale=") == 0)
- bw_weight_param = params;
- else
- bw_weight_param = strstr(params, " bwweightscale=");
+ if (params) {
+ if (strcmpstart(params, "bwweightscale=") == 0)
+ bw_weight_param = params;
+ else
+ bw_weight_param = strstr(params, " bwweightscale=");
+ }
if (bw_weight_param) {
int ok=0;