]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Check magic number in connection_ap_attach_pending
authorNick Mathewson <nickm@torproject.org>
Fri, 27 Nov 2015 16:21:51 +0000 (11:21 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 27 Nov 2015 16:21:51 +0000 (11:21 -0500)
src/or/connection_edge.c

index 496fe21b11bbade6c84760a65c73c0b158bbe4d7..8b2f635b230f1759cda0f23a30c0a289e284ff74 100644 (file)
@@ -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?",