From dd8f16beb555b8d46a7d5157743c762fb4a37068 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Sat, 29 Aug 2009 19:41:08 +0200 Subject: [PATCH 1/2] Avoid segfault when accessing hidden service. --- ChangeLog | 3 +++ src/or/rendclient.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34ba6a7168..6282157f1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ Changes in version 0.2.1.20 - 2009-??-?? a wrong clock. Instead, we should only inform the controller when it's a trusted authority that claims our clock is wrong. Bugfix on 0.2.0.20-rc; starts to fix bug 1074. Reported by SwissTorExit. + - Avoid segfault in rare cases when finishing an introduction circuit + as a client and finding out that we don't have an introduction key + for it. Fixes bug 1073. Reported by Aaron Swartz. Changes in version 0.2.1.19 - 2009-07-28 diff --git a/src/or/rendclient.c b/src/or/rendclient.c index a5d7c1016e..5e3c20e807 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -94,6 +94,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc, } }); if (!intro_key) { + int num_intro_points = smartlist_len(entry->parsed->intro_nodes); if (rend_cache_lookup_entry(introcirc->rend_data->onion_address, 0, &entry) > 0) { log_warn(LD_BUG, "We have both a v0 and a v2 rend desc for this " @@ -109,7 +110,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc, } else { log_warn(LD_BUG, "Internal error: could not find intro key; we " "only have a v2 rend desc with %d intro points.", - smartlist_len(entry->parsed->intro_nodes)); + num_intro_points); goto err; } } From da219ee92445a8defa1ef33ffa2e82b63afe0402 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Tue, 1 Sep 2009 00:16:33 +0200 Subject: [PATCH 2/2] Reduce log level for bug case that we now know really exists. --- src/or/rendclient.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 5e3c20e807..3dd77a854b 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -94,10 +94,14 @@ rend_client_send_introduction(origin_circuit_t *introcirc, } }); if (!intro_key) { + /** XXX This case probably means that the intro point vanished while + * we were building a circuit to it. In the future, we should find + * out how that happened and whether we should kill the circuits to + * removed intro points immediately. See task 1073. */ int num_intro_points = smartlist_len(entry->parsed->intro_nodes); if (rend_cache_lookup_entry(introcirc->rend_data->onion_address, 0, &entry) > 0) { - log_warn(LD_BUG, "We have both a v0 and a v2 rend desc for this " + log_info(LD_REND, "We have both a v0 and a v2 rend desc for this " "service. The v2 desc doesn't contain the introduction " "point (and key) to send an INTRODUCE1/2 cell to this " "introduction point. Assuming the introduction point " @@ -108,7 +112,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc, /* See flyspray task 1024. */ intro_key = entry->parsed->pk; } else { - log_warn(LD_BUG, "Internal error: could not find intro key; we " + log_info(LD_REND, "Internal error: could not find intro key; we " "only have a v2 rend desc with %d intro points.", num_intro_points); goto err;