diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-09-13 11:45:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-09-13 11:45:05 -0400 |
commit | c8b98ba41ce37662cf14fdb3c6a74ae83b8b0bf8 (patch) | |
tree | 31a16ace0d585fb8491e4d3edf9be00f8a578ef0 /src/or/or.h | |
parent | 582f2187a769ea723f6bf13bc91f7a4b3c861408 (diff) | |
download | tor-c8b98ba41ce37662cf14fdb3c6a74ae83b8b0bf8.tar.gz tor-c8b98ba41ce37662cf14fdb3c6a74ae83b8b0bf8.zip |
Reject votes (not consensuses) with >64 known-flags
Our flag voting code needs to handle unrecognized flags, so it stores
them in a 64-bit bitfield. But we never actually checked for too many
flags, so we were potentially doing stuff like U64_LITERAL(1)<<flagnum
with flagnum >= 64. That's undefined behavior.
Fix for bug 6833; bugfix on 0.2.0.1-alpha.
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index bb5482bf83..f7914b830d 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2101,6 +2101,9 @@ typedef struct vote_microdesc_hash_t { typedef struct vote_routerstatus_t { routerstatus_t status; /**< Underlying 'status' object for this router. * Flags are redundant. */ + /** How many known-flags are allowed in a vote? This is the width of + * the flags field of vote_routerstatus_t */ +#define MAX_KNOWN_FLAGS_IN_VOTE 64 uint64_t flags; /**< Bit-field for all recognized flags; index into * networkstatus_t.known_flags. */ char *version; /**< The version that the authority says this router is |