]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Defensive programming: clear rs_out between iterations.
authorNick Mathewson <nickm@torproject.org>
Wed, 1 Aug 2012 21:25:34 +0000 (17:25 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 1 Aug 2012 21:25:34 +0000 (17:25 -0400)
I can't currently find a bug here, but there are a couple of
near-misses.  Addresses ticket 6514; reported pseudonymously on
IRC.

changes/bug6514 [new file with mode: 0644]
src/or/dirvote.c

diff --git a/changes/bug6514 b/changes/bug6514
new file mode 100644 (file)
index 0000000..84633bd
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Add a (probably redundant) memory clear between iterations of
+      the router status voting loop, to prevent future coding errors
+      where data might leak between iterations of the loop. Resolves
+      ticket 6514.
index 79958739a5f98d754344a561651269e7bdd8a6e0..bc7797355c5fcb8236d8d87df3faa17a31988f1a 100644 (file)
@@ -1752,6 +1752,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
       rs = compute_routerstatus_consensus(matching_descs, consensus_method,
                                           microdesc_digest);
       /* Copy bits of that into rs_out. */
+      memset(&rs_out, 0, sizeof(rs_out));
       tor_assert(fast_memeq(lowest_id, rs->status.identity_digest,DIGEST_LEN));
       memcpy(rs_out.identity_digest, lowest_id, DIGEST_LEN);
       memcpy(rs_out.descriptor_digest, rs->status.descriptor_digest,