diff options
author | Roger Dingledine <arma@torproject.org> | 2009-09-02 20:36:11 -0400 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2009-09-02 20:36:11 -0400 |
commit | fcacf224913b3a0a08cef06a7241348f49b26e49 (patch) | |
tree | b8bc10c183da61fb93bd366c3703ead34f22192e /src/or/rendservice.c | |
parent | 3db36d86c48f47b63e7597a9d28fd02ed577aa50 (diff) | |
download | tor-fcacf224913b3a0a08cef06a7241348f49b26e49.tar.gz tor-fcacf224913b3a0a08cef06a7241348f49b26e49.zip |
Fix obscure 64-bit big-endian hidserv bug
Fix an obscure bug where hidden services on 64-bit big-endian
systems might mis-read the timestamp in v3 introduce cells, and
refuse to connect back to the client. Discovered by "rotor".
Bugfix on 0.2.1.6-alpha.
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r-- | src/or/rendservice.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 7ba00993c4..3144ef2f04 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1011,13 +1011,12 @@ rend_service_introduce(origin_circuit_t *circuit, const char *request, } /* Check timestamp. */ - memcpy((char*)&ts, buf+1+v3_shift, sizeof(uint32_t)); + ts = ntohl(get_uint32(buf+1+v3_shift)); v3_shift += 4; - ts = ntohl((uint32_t)ts); if ((now - ts) < -1 * REND_REPLAY_TIME_INTERVAL / 2 || (now - ts) > REND_REPLAY_TIME_INTERVAL / 2) { log_warn(LD_REND, "INTRODUCE2 cell is too %s. Discarding.", - (now - ts) < 0 ? "old" : "new"); + (now - ts) < 0 ? "old" : "new"); return -1; } } |