]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Segfault less during consensus generation without params
authorSebastian Hahn <sebastian@torproject.org>
Sun, 21 Mar 2010 05:03:13 +0000 (06:03 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Mon, 29 Mar 2010 20:25:37 +0000 (22:25 +0200)
If no authority votes on any params, Tor authorities segfault when
trying to make a new consensus from the votes. Let's change that.

changes/dont_segfault_while_making_consensus_without_params [new file with mode: 0644]
src/or/dirvote.c

diff --git a/changes/dont_segfault_while_making_consensus_without_params b/changes/dont_segfault_while_making_consensus_without_params
new file mode 100644 (file)
index 0000000..e0bcd40
--- /dev/null
@@ -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.
index ecf236e8fe80e7205b64d60ac6a502898f4d091e..30e340c73599eb43cbf9458c23299ae9e0e81a53 100644 (file)
@@ -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;