diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-11-12 14:49:17 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-11-12 14:49:17 +0000 |
commit | 6694a8603305ab15cc11b9e983cedd4553a45277 (patch) | |
tree | 52f2e518af00c1db75e3b0b9fb70079850144bc0 | |
parent | ec9690b0f8db68eeff1edf5347b2a6885d58bfd5 (diff) | |
download | tor-6694a8603305ab15cc11b9e983cedd4553a45277.tar.gz tor-6694a8603305ab15cc11b9e983cedd4553a45277.zip |
Backport: Apparently sparc64 is way more strict about uint16_t access alignment than I had thought: it gave bus errors when messing with var-cell headers. Maybe this patch will fix bug 862.
svn:r17263
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/or/buffers.c | 2 | ||||
-rw-r--r-- | src/or/connection_or.c | 2 |
3 files changed, 4 insertions, 2 deletions
@@ -48,6 +48,8 @@ Changes in version 0.2.0.32 - 2008-??-?? Bugfix on 0.2.0.x (??). - Remove the old v2 directory authority 'lefkada' from the default list. It has been gone for many months. + - Stop doing unaligned memory access that generated bus errors on + sparc64. Bugfix on 0.2.0.10-alpha. Fix for bug 862. o Minor bugfixes (controller): - Make DNS resolved events into "CLOSED", not "FAILED". Bugfix on diff --git a/src/or/buffers.c b/src/or/buffers.c index eb1be863a9..b16091c30b 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -966,7 +966,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto) return 1; result = var_cell_new(length); result->command = command; - result->circ_id = ntohs(*(uint16_t*)hdr); + result->circ_id = ntohs(get_uint16(hdr)); buf_remove_from_front(buf, VAR_CELL_HEADER_SIZE); peek_from_buf(result->payload, length, buf); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 00217f2dcb..7d1231567c 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -157,7 +157,7 @@ cell_unpack(cell_t *dest, const char *src) void var_cell_pack_header(const var_cell_t *cell, char *hdr_out) { - *(uint16_t*)(hdr_out) = htons(cell->circ_id); + set_uint16(hdr_out, htons(cell->circ_id)); *(uint8_t*)(hdr_out+2) = cell->command; set_uint16(hdr_out+3, htons(cell->payload_len)); } |