summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-08-31 14:20:41 +0000
committerNick Mathewson <nickm@torproject.org>2007-08-31 14:20:41 +0000
commitff7e0e89710b6249d47497a4bce968bae6ab0ccc (patch)
tree81c70325ae7a2a7ca0da9d87de5c0ed8a8e5d89f /src
parentddd44cb6023520474ad8641504583d84402890ee (diff)
downloadtor-ff7e0e89710b6249d47497a4bce968bae6ab0ccc.tar.gz
tor-ff7e0e89710b6249d47497a4bce968bae6ab0ccc.zip
r14875@catbus: nickm | 2007-08-31 10:18:11 -0400
Backport: Check correct circuit type when calling functions from rend_process_relay_cell. svn:r11335
Diffstat (limited to 'src')
-rw-r--r--src/or/rendcommon.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index ac070919fc..287d089459 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -436,7 +436,7 @@ rend_process_relay_cell(circuit_t *circ, int command, size_t length,
{
or_circuit_t *or_circ = NULL;
origin_circuit_t *origin_circ = NULL;
- int r;
+ int r=0;
if (CIRCUIT_IS_ORIGIN(circ))
origin_circ = TO_ORIGIN_CIRCUIT(circ);
else
@@ -444,31 +444,40 @@ rend_process_relay_cell(circuit_t *circ, int command, size_t length,
switch (command) {
case RELAY_COMMAND_ESTABLISH_INTRO:
- r = rend_mid_establish_intro(or_circ,payload,length);
+ if (or_circ)
+ r = rend_mid_establish_intro(or_circ,payload,length);
break;
case RELAY_COMMAND_ESTABLISH_RENDEZVOUS:
- r = rend_mid_establish_rendezvous(or_circ,payload,length);
+ if (or_circ)
+ r = rend_mid_establish_rendezvous(or_circ,payload,length);
break;
case RELAY_COMMAND_INTRODUCE1:
- r = rend_mid_introduce(or_circ,payload,length);
+ if (or_circ)
+ r = rend_mid_introduce(or_circ,payload,length);
break;
case RELAY_COMMAND_INTRODUCE2:
- r = rend_service_introduce(origin_circ,payload,length);
+ if (origin_circ)
+ r = rend_service_introduce(origin_circ,payload,length);
break;
case RELAY_COMMAND_INTRODUCE_ACK:
- r = rend_client_introduction_acked(origin_circ,payload,length);
+ if (origin_circ)
+ r = rend_client_introduction_acked(origin_circ,payload,length);
break;
case RELAY_COMMAND_RENDEZVOUS1:
- r = rend_mid_rendezvous(or_circ,payload,length);
+ if (or_circ)
+ r = rend_mid_rendezvous(or_circ,payload,length);
break;
case RELAY_COMMAND_RENDEZVOUS2:
- r = rend_client_receive_rendezvous(origin_circ,payload,length);
+ if (origin_circ)
+ r = rend_client_receive_rendezvous(origin_circ,payload,length);
break;
case RELAY_COMMAND_INTRO_ESTABLISHED:
- r = rend_service_intro_established(origin_circ,payload,length);
+ if (origin_circ)
+ r = rend_service_intro_established(origin_circ,payload,length);
break;
case RELAY_COMMAND_RENDEZVOUS_ESTABLISHED:
- r = rend_client_rendezvous_acked(origin_circ,payload,length);
+ if (origin_circ)
+ r = rend_client_rendezvous_acked(origin_circ,payload,length);
break;
default:
tor_assert(0);