]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Backport: Apparently sparc64 is way more strict about uint16_t access alignment than...
authorNick Mathewson <nickm@torproject.org>
Wed, 12 Nov 2008 14:49:17 +0000 (14:49 +0000)
committerNick Mathewson <nickm@torproject.org>
Wed, 12 Nov 2008 14:49:17 +0000 (14:49 +0000)
svn:r17263

ChangeLog
src/or/buffers.c
src/or/connection_or.c

index 41437a4db5ca4f40bcff144ec03dd3f8bc255f13..bafa2b8c44e478d72413d3d1cceda4f39b575095 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index eb1be863a977be9dbe6c69e4148a48ac65079745..b16091c30be6fb7d2947f6aa9390353519d8145d 100644 (file)
@@ -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);
index 00217f2dcbd994f8f4e20e4a993238c956843ccb..7d1231567c0a9c7ddc312e09b61f3427fd2e3a24 100644 (file)
@@ -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));
 }