aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2010-03-21 06:03:13 +0100
committerSebastian Hahn <sebastian@torproject.org>2010-03-29 22:25:37 +0200
commitcae769d646e721efff3c286a2c46769680dc01f5 (patch)
treec4abb47f1a5ad3e284fbc0db6572f8cda61c9d58 /src/or
parent28cda33299d2654ff43b7174c9e71fb64ad53b3b (diff)
downloadtor-cae769d646e721efff3c286a2c46769680dc01f5.tar
tor-cae769d646e721efff3c286a2c46769680dc01f5.tar.gz
Segfault less during consensus generation without params
If no authority votes on any params, Tor authorities segfault when trying to make a new consensus from the votes. Let's change that.
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dirvote.c10
1 files changed, 6 insertions, 4 deletions
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;