From 68b2a57ffd719c1daf24c387ad37d795152eb8ae Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 17 Apr 2008 20:23:24 +0000 Subject: [PATCH] r15239@tombo: nickm | 2008-04-17 16:22:50 -0400 Backport: Do not allocate excess space for named_flag and unnamed_flag in dirvote.c. Fixes bug 662. Not a dangerous bug: sizeof(int*) is at least as big as sizeof(int) everywhere. svn:r14392 --- ChangeLog | 2 ++ src/or/dirvote.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7651d042de..9fcb344afb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,8 @@ Changes in version 0.2.0.24-rc - 2008-04-0? - Fix a dumb bug that was preventing us from knowing that we should preemptively build circuits to handle expected directory requests. Fixes bug 660. Bugfix on 0.1.2.x. + - Avoid allocating extra space when computing consensuses on + 64-bit platforms. Bug spotted by aakova. Changes in version 0.2.0.23-rc - 2008-03-24 diff --git a/src/or/dirvote.c b/src/or/dirvote.c index fbbd82ee28..e4afacc61d 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -641,8 +641,8 @@ networkstatus_compute_consensus(smartlist_t *votes, n_voter_flags = tor_malloc_zero(sizeof(int) * smartlist_len(votes)); n_flag_voters = tor_malloc_zero(sizeof(int) * smartlist_len(flags)); flag_map = tor_malloc_zero(sizeof(int*) * smartlist_len(votes)); - named_flag = tor_malloc_zero(sizeof(int*) * smartlist_len(votes)); - unnamed_flag = tor_malloc_zero(sizeof(int*) * smartlist_len(votes)); + named_flag = tor_malloc_zero(sizeof(int) * smartlist_len(votes)); + unnamed_flag = tor_malloc_zero(sizeof(int) * smartlist_len(votes)); for (i = 0; i < smartlist_len(votes); ++i) unnamed_flag[i] = named_flag[i] = -1; chosen_named_idx = smartlist_string_pos(flags, "Named");