summaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-11-12 14:41:44 +0000
committerNick Mathewson <nickm@torproject.org>2008-11-12 14:41:44 +0000
commitc36ddcbabf60df9f26ece0777766defd7fee751f (patch)
tree0ec657cbb0b90a629b417a5379f77372a230d8bb /src/or/buffers.c
parenta790a13705e9d838a4092435ed981179054c6beb (diff)
downloadtor-c36ddcbabf60df9f26ece0777766defd7fee751f.tar.gz
tor-c36ddcbabf60df9f26ece0777766defd7fee751f.zip
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:r17262
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index ba70e555dc..cb36a523e2 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -1010,7 +1010,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto)
return 0;
peek_from_buf(hdr, sizeof(hdr), buf);
- command = *(uint8_t*)(hdr+2);
+ command = get_uint8(hdr+2);
if (!(CELL_COMMAND_IS_VAR_LENGTH(command)))
return 0;
@@ -1019,7 +1019,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);