summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-04-17 20:23:24 +0000
committerNick Mathewson <nickm@torproject.org>2008-04-17 20:23:24 +0000
commit68b2a57ffd719c1daf24c387ad37d795152eb8ae (patch)
tree2214ae6749273b2fb968583f101852bf66c8ec54
parentfbb0c6eec342e7964c10c1cb7ece8497b6ed940b (diff)
downloadtor-68b2a57ffd719c1daf24c387ad37d795152eb8ae.tar.gz
tor-68b2a57ffd719c1daf24c387ad37d795152eb8ae.zip
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
-rw-r--r--ChangeLog2
-rw-r--r--src/or/dirvote.c4
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");