diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-05-13 11:05:33 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-05-13 11:05:33 -0400 |
commit | 614d9bc9674cfb7807b0423bb43fc1c184501144 (patch) | |
tree | 279742d5ed3f891459877ddbb949ca3bed448ef0 /src | |
parent | 26c344a563610fcd293cd82bbb0b08dce737e5f3 (diff) | |
parent | 8aa04408fb724d55e95419ec9f0568c7d733acb5 (diff) | |
download | tor-614d9bc9674cfb7807b0423bb43fc1c184501144.tar.gz tor-614d9bc9674cfb7807b0423bb43fc1c184501144.zip |
Merge remote-tracking branch 'origin/maint-0.2.5' into maint-0.2.6
Diffstat (limited to 'src')
-rw-r--r-- | src/or/rendservice.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index fbbb2aba17..111b369b1c 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1098,11 +1098,13 @@ rend_service_requires_uptime(rend_service_t *service) return 0; } -/** Check client authorization of a given <b>descriptor_cookie</b> for - * <b>service</b>. Return 1 for success and 0 for failure. */ +/** Check client authorization of a given <b>descriptor_cookie</b> of + * length <b>cookie_len</b> for <b>service</b>. Return 1 for success + * and 0 for failure. */ static int rend_check_authorization(rend_service_t *service, - const char *descriptor_cookie) + const char *descriptor_cookie, + size_t cookie_len) { rend_authorized_client_t *auth_client = NULL; tor_assert(service); @@ -1113,6 +1115,13 @@ rend_check_authorization(rend_service_t *service, return 0; } + if (cookie_len != REND_DESC_COOKIE_LEN) { + log_info(LD_REND, "Descriptor cookie is %lu bytes, but we expected " + "%lu bytes. Dropping cell.", + (unsigned long)cookie_len, (unsigned long)REND_DESC_COOKIE_LEN); + return 0; + } + /* Look up client authorization by descriptor cookie. */ SMARTLIST_FOREACH(service->clients, rend_authorized_client_t *, client, { if (tor_memeq(client->descriptor_cookie, descriptor_cookie, @@ -1459,7 +1468,8 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request, if (service->clients) { if (parsed_req->version == 3 && parsed_req->u.v3.auth_len > 0) { if (rend_check_authorization(service, - (const char*)parsed_req->u.v3.auth_data)) { + (const char*)parsed_req->u.v3.auth_data, + parsed_req->u.v3.auth_len)) { log_info(LD_REND, "Authorization data in INTRODUCE2 cell are valid."); } else { log_info(LD_REND, "The authorization data that are contained in " |