aboutsummaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-03-20 09:30:30 +0000
committerRoger Dingledine <arma@torproject.org>2004-03-20 09:30:30 +0000
commit66f878513f1aa62c14984eddad32c6a3c7b26025 (patch)
treeeddaf299cda394bea7b5ffb23c9e9b0732ea8941 /src/or/cpuworker.c
parent2ba2f0218130731e46fed9cc565d0b802d4f4a31 (diff)
downloadtor-66f878513f1aa62c14984eddad32c6a3c7b26025.tar
tor-66f878513f1aa62c14984eddad32c6a3c7b26025.tar.gz
deal with hardware word alignment
this was causing the seg faults on sparc processors i wonder if i got them all. svn:r1314
Diffstat (limited to 'src/or/cpuworker.c')
-rw-r--r--src/or/cpuworker.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index ba7a0837a..17216cc18 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -48,6 +48,7 @@ static void tag_unpack(char *tag, uint32_t *addr, uint16_t *port, uint16_t *circ
}
int connection_cpu_process_inbuf(connection_t *conn) {
+ char success;
unsigned char buf[LEN_ONION_RESPONSE];
uint32_t addr;
uint16_t port;
@@ -77,10 +78,11 @@ int connection_cpu_process_inbuf(connection_t *conn) {
return 0; /* not yet */
assert(buf_datalen(conn->inbuf) == LEN_ONION_RESPONSE);
- connection_fetch_from_buf(buf,LEN_ONION_RESPONSE,conn);
+ connection_fetch_from_buf(&success,1,conn);
+ connection_fetch_from_buf(buf,LEN_ONION_RESPONSE-1,conn);
/* parse out the circ it was talking about */
- tag_unpack(buf+1, &addr, &port, &circ_id);
+ tag_unpack(buf, &addr, &port, &circ_id);
circ = NULL;
p_conn = connection_exact_get_by_addr_port(addr,port);
if(p_conn)
@@ -91,12 +93,12 @@ int connection_cpu_process_inbuf(connection_t *conn) {
goto done_processing;
}
assert(circ->p_conn);
- if(*buf == 0) {
+ if(success == 0) {
log_fn(LOG_WARN,"decoding onionskin failed. Closing.");
circuit_mark_for_close(circ);
goto done_processing;
}
- if(onionskin_answer(circ, buf+1+TAG_LEN, buf+1+TAG_LEN+ONIONSKIN_REPLY_LEN) < 0) {
+ if(onionskin_answer(circ, buf+TAG_LEN, buf+TAG_LEN+ONIONSKIN_REPLY_LEN) < 0) {
log_fn(LOG_WARN,"onionskin_answer failed. Closing.");
circuit_mark_for_close(circ);
goto done_processing;