aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-10-11 01:17:42 +0000
committerRoger Dingledine <arma@torproject.org>2004-10-11 01:17:42 +0000
commit7798e3d770b46a039fcf47c25c26a467eed4e0ce (patch)
tree5202d8cd23ecaa8d72ec2379d9d40aa5ca5ee67b /src
parent6468e049be8e17d012068d2cdaa0272bcfd8a2a7 (diff)
downloadtor-7798e3d770b46a039fcf47c25c26a467eed4e0ce.tar.gz
tor-7798e3d770b46a039fcf47c25c26a467eed4e0ce.zip
fix the stale pointer assert bug reported by joe magic
svn:r2436
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c6
-rw-r--r--src/or/circuitlist.c1
-rw-r--r--src/or/circuituse.c2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index eb4764d156..86d7d3af18 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -633,8 +633,8 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
* just give up: for circ to close, and return 0.
*/
int circuit_truncated(circuit_t *circ, crypt_path_t *layer) {
- crypt_path_t *victim;
- connection_t *stream;
+// crypt_path_t *victim;
+// connection_t *stream;
tor_assert(circ && CIRCUIT_IS_ORIGIN(circ));
tor_assert(layer);
@@ -646,6 +646,7 @@ int circuit_truncated(circuit_t *circ, crypt_path_t *layer) {
circuit_mark_for_close(circ);
return 0;
+#if 0
while(layer->next != circ->cpath) {
/* we need to clear out layer->next */
victim = layer->next;
@@ -668,6 +669,7 @@ int circuit_truncated(circuit_t *circ, crypt_path_t *layer) {
log_fn(LOG_INFO, "finished");
return 0;
+#endif
}
/** Decide whether the first bit of the circuit ID will be
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index f66a4b9900..76e3be9252 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -411,6 +411,7 @@ void assert_cpath_layer_ok(const crypt_path_t *cp)
tor_assert(cp->handshake_state);
break;
default:
+ log_fn(LOG_WARN,"Unexpected state %d",cp->state);
tor_assert(0);
}
tor_assert(cp->package_window >= 0);
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index e52835ef03..70eb0363f2 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -333,6 +333,8 @@ void circuit_detach_stream(circuit_t *circ, connection_t *conn) {
tor_assert(circ && conn);
+ conn->cpath_layer = NULL; /* make sure we don't keep a stale pointer */
+
if(conn == circ->p_streams) {
circ->p_streams = conn->next_stream;
return;