diff options
author | Roger Dingledine <arma@torproject.org> | 2004-03-20 09:30:30 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-03-20 09:30:30 +0000 |
commit | 66f878513f1aa62c14984eddad32c6a3c7b26025 (patch) | |
tree | eddaf299cda394bea7b5ffb23c9e9b0732ea8941 /src/or/circuit.c | |
parent | 2ba2f0218130731e46fed9cc565d0b802d4f4a31 (diff) | |
download | tor-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/circuit.c')
-rw-r--r-- | src/or/circuit.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 2cadd6d7d..9c07532ff 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -1116,8 +1116,13 @@ int circuit_extend(cell_t *cell, circuit_t *circ) { return -1; } - circ->n_addr = ntohl(*(uint32_t*)(cell->payload+RELAY_HEADER_SIZE)); - circ->n_port = ntohs(*(uint16_t*)(cell->payload+RELAY_HEADER_SIZE+4)); + memcpy(&circ->n_addr, cell->payload+RELAY_HEADER_SIZE, 4); + circ->n_addr = ntohl(circ->n_addr); + memcpy(&circ->n_port, cell->payload+RELAY_HEADER_SIZE+4, 2); + circ->n_port = ntohs(circ->n_port); + +// circ->n_addr = ntohl(*(uint32_t*)(cell->payload+RELAY_HEADER_SIZE)); +// circ->n_port = ntohs(*(uint16_t*)(cell->payload+RELAY_HEADER_SIZE+4)); n_conn = connection_twin_get_by_addr_port(circ->n_addr,circ->n_port); if(!n_conn || n_conn->type != CONN_TYPE_OR) { |