summaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-07-30 04:32:58 +0000
committerRoger Dingledine <arma@torproject.org>2006-07-30 04:32:58 +0000
commit2bcb081cb1d788b46d5ce86e085549fe5b1d3b81 (patch)
tree922cae7e61679bef19f388ee34c3001872966364 /src/or/circuitbuild.c
parent7498d31b0981b4c0175dca0f7d3aa5e008725cbd (diff)
downloadtor-2bcb081cb1d788b46d5ce86e085549fe5b1d3b81.tar.gz
tor-2bcb081cb1d788b46d5ce86e085549fe5b1d3b81.zip
defense in depth
svn:r6939
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index d2973203ac..fa5da30c49 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -625,11 +625,17 @@ circuit_extend(cell_t *cell, circuit_t *circ)
char *id_digest=NULL;
if (circ->n_conn) {
- log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"n_conn already set. Bug/attack. Closing.");
return -1;
}
+ if (!server_mode(get_options())) {
+ log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
+ "Got an extend cell, but running as a client. Closing.");
+ return -1;
+ }
+
relay_header_unpack(&rh, cell->payload);
if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) {