diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-02-25 07:31:46 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-02-25 07:31:46 +0000 |
commit | 496e414e5208fe4c196a645e2f64ba712d893f6e (patch) | |
tree | 50778a6e14363e60bd61d292be1e08eee2133693 /src/or/circuit.c | |
parent | 1b25794a56654e115fa46ac9bfc6334753f6dda1 (diff) | |
download | tor-496e414e5208fe4c196a645e2f64ba712d893f6e.tar tor-496e414e5208fe4c196a645e2f64ba712d893f6e.tar.gz |
Basic RAM poisoning and magic-checking to notice connection and circuit
corruption faster; also, check for corruption in dns.c so we can fail fast
for the bug that's nailing Lucky and moria3.
svn:r1123
Diffstat (limited to 'src/or/circuit.c')
-rw-r--r-- | src/or/circuit.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 4b156bb33..5d429c205 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -60,6 +60,7 @@ circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) { circuit_t *circ; circ = tor_malloc_zero(sizeof(circuit_t)); + circ->magic = CIRCUIT_MAGIC; circ->timestamp_created = time(NULL); @@ -84,6 +85,7 @@ circuit_t *circuit_new(uint16_t p_circ_id, connection_t *p_conn) { void circuit_free(circuit_t *circ) { assert(circ); + assert(circ->magic == CIRCUIT_MAGIC); if (circ->n_crypto) crypto_free_cipher_env(circ->n_crypto); if (circ->p_crypto) @@ -96,6 +98,7 @@ void circuit_free(circuit_t *circ) { tor_free(circ->build_state->chosen_exit); tor_free(circ->build_state); circuit_free_cpath(circ->cpath); + memset(circ, 0xAA, sizeof(circuit_t)); /* poison memory */ free(circ); } @@ -1217,6 +1220,8 @@ void assert_circuit_ok(const circuit_t *c) { connection_t *conn; + assert(c); + assert(c->magic == CIRCUIT_MAGIC); assert(c->n_addr); assert(c->n_port); assert(c->n_conn); |