[tor-commits] [tor/master] Check magic number in connection_ap_attach_pending

nickm at torproject.org nickm at torproject.org
Fri Nov 27 16:21:58 UTC 2015


commit 5665775e8c822d45282d1d56a01a0f5883c7b070
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Nov 27 11:21:51 2015 -0500

    Check magic number in connection_ap_attach_pending
---
 src/or/connection_edge.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 496fe21..8b2f635 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -799,6 +799,12 @@ connection_ap_attach_pending(int retry)
       SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
       continue;
     }
+    if (conn->magic != ENTRY_CONNECTION_MAGIC) {
+      log_warn(LD_BUG, "%p has impossible magic value %u",
+               entry_conn, (unsigned)conn->magic);
+      SMARTLIST_DEL_CURRENT(pending_entry_connections, entry_conn);
+      continue;
+    }
     if (conn->state != AP_CONN_STATE_CIRCUIT_WAIT) {
       log_warn(LD_BUG, "%p is no longer in circuit_wait. Its current state "
                "is %s. Why is it on pending_entry_connections?",



More information about the tor-commits mailing list