]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix potential null pointer deref during dirvote
authorSebastian Hahn <sebastian@torproject.org>
Tue, 26 Apr 2011 02:38:55 +0000 (04:38 +0200)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 May 2011 17:19:46 +0000 (13:19 -0400)
Found by using clang's analyzer.

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

diff --git a/changes/dirvote_null_deref b/changes/dirvote_null_deref
new file mode 100644 (file)
index 0000000..65dc519
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes:
+    - Fix a potential null-pointer dereference while computing a consensus.
+      Bugfix on tor-0.2.0.3-alpha, found with the help of clang's analyzer.
+
index db2eaf0f4f5b252d4c0019d281755844032d78a3..750c649f514bd0f60837032d95c58f8ace257188 100644 (file)
@@ -444,9 +444,9 @@ compute_routerstatus_consensus(smartlist_t *votes, int consensus_method,
     if (cur && !compare_vote_rs(cur, rs)) {
       ++cur_n;
     } else {
-      if (cur_n > most_n ||
-          (cur && cur_n == most_n &&
-           cur->status.published_on > most_published)) {
+      if (cur && (cur_n > most_n ||
+                  (cur_n == most_n &&
+                   cur->status.published_on > most_published))) {
         most = cur;
         most_n = cur_n;
         most_published = cur->status.published_on;