[tor-commits] [tor/master] Move router lookup to _after_ we assert that its argument is set

nickm at torproject.org nickm at torproject.org
Fri Mar 30 14:18:00 UTC 2012


commit 491ffa540fda6a9cd8d75aad7d20945a3ae1df65
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Mar 30 10:14:31 2012 -0400

    Move router lookup to _after_ we assert that its argument is set
    
    A previous commit in the 5527 branch had moved
    router_get_mutable_by_digest(digest_rcvd) to happen before we did
    tor_assert(digest_rcvd), which would have defeated the purpose of
    the assert.
---
 src/or/dirserv.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index dfecbc8..11f235c 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -3271,11 +3271,13 @@ dirserv_orconn_tls_done(const char *address,
                         uint16_t or_port,
                         const char *digest_rcvd)
 {
-  routerinfo_t *ri = router_get_mutable_by_digest(digest_rcvd);
+  routerinfo_t *ri;
   time_t now = time(NULL);
   tor_assert(address);
   tor_assert(digest_rcvd);
 
+  ri = router_get_mutable_by_digest(digest_rcvd);
+
   if (ri == NULL)
     return;
 





More information about the tor-commits mailing list