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

[tor-commits] [tor/master] Parse votes with >31 flags correctly



commit 414adb237bc51e0e1b7321364dd73d9b3e635733
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Sep 17 10:24:52 2012 -0400

    Parse votes with >31 flags correctly
    
    We were doing (1<<p) to generate a flag at position p, but we should
    have been doing (U64_LITERAL(1)<<p).
    
    Fixes bug 6861; bugfix on 0.2.0.3-alpha; reported pseudonymously.
---
 changes/bug6853      |    3 +++
 src/or/routerparse.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/changes/bug6853 b/changes/bug6853
new file mode 100644
index 0000000..382adfb
--- /dev/null
+++ b/changes/bug6853
@@ -0,0 +1,3 @@
+  o Minor bugfixes (directory authority):
+    - Correctly handle votes with more than 31 flags. Fixes bug 6853;
+      bugfix on 0.2.0.3-alpha.
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 2bf072b..022add3 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -2067,7 +2067,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
     for (i=0; i < tok->n_args; ++i) {
       int p = smartlist_string_pos(vote->known_flags, tok->args[i]);
       if (p >= 0) {
-        vote_rs->flags |= (1<<p);
+        vote_rs->flags |= (U64_LITERAL(1)<<p);
       } else {
         log_warn(LD_DIR, "Flags line had a flag %s not listed in known_flags.",
                  escaped(tok->args[i]));



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