[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] defensive programming to catch duplicate calls to connection_init_or_handshake_state



commit ce703bd53edec2ee123dd747d6cc975a259c68f9
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 26 20:19:25 2011 -0400

    defensive programming to catch duplicate calls to connection_init_or_handshake_state
---
 src/or/connection_or.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 7609138..76402a5 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1583,6 +1583,10 @@ int
 connection_init_or_handshake_state(or_connection_t *conn, int started_here)
 {
   or_handshake_state_t *s;
+  if (conn->handshake_state) {
+    log_warn(LD_BUG, "Duplicate call to connection_init_or_handshake_state!");
+    return 0;
+  }
   s = conn->handshake_state = tor_malloc_zero(sizeof(or_handshake_state_t));
   s->started_here = started_here ? 1 : 0;
   s->digest_sent_data = 1;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits