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

[or-cvs] Fix a segfault caused by a weird logic error and masked by ...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv1497/or

Modified Files:
	connection_edge.c onion.c 
Log Message:
Fix a segfault caused by a weird logic error and masked by another.

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- connection_edge.c	17 Nov 2003 00:57:56 -0000	1.59
+++ connection_edge.c	17 Nov 2003 01:20:35 -0000	1.60
@@ -772,6 +772,10 @@
 {
   uint32_t addr;
 
+  assert(conn);
+  assert(conn->type == CONN_TYPE_AP);
+  assert(conn->socks_request);
+
   addr = client_dns_lookup_entry(conn->socks_request->address);
   return router_supports_exit_address(addr, conn->port, exit);
 }

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- onion.c	16 Nov 2003 23:43:08 -0000	1.86
+++ onion.c	17 Nov 2003 01:20:35 -0000	1.87
@@ -245,10 +245,10 @@
   n_maybe_supported = tor_malloc(sizeof(int)*dir->n_routers);
   for (i = 0; i < dir->n_routers; ++i) {
     n_supported[i] = n_maybe_supported[i] = 0;
-    for (j = 0; j < n_pending_connections; ++j) {
-      if (carray[i]->type != CONN_TYPE_AP || 
-          carray[i]->state == AP_CONN_STATE_CIRCUIT_WAIT ||
-          carray[i]->marked_for_close)
+    for (j = 0; j < n_connections; ++j) {
+      if (carray[j]->type != CONN_TYPE_AP || 
+          carray[j]->state == AP_CONN_STATE_CIRCUIT_WAIT ||
+          carray[j]->marked_for_close)
         continue;
       switch (connection_ap_can_use_exit(carray[j], dir->routers[i])) 
         {