[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix potential null pointer deref during dirvote



commit 1c668540fef93d71e72cfed73955ee705f27163e
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date:   Tue Apr 26 04:38:55 2011 +0200

    Fix potential null pointer deref during dirvote
    
    Found by using clang's analyzer.
---
 changes/dirvote_null_deref |    4 ++++
 src/or/dirvote.c           |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/changes/dirvote_null_deref b/changes/dirvote_null_deref
new file mode 100644
index 0000000..65dc519
--- /dev/null
+++ b/changes/dirvote_null_deref
@@ -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.
+
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index db2eaf0..750c649 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -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;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits