summaryrefslogtreecommitdiff
path: root/src/or/rendclient.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@persephoneslair.org>2012-06-15 21:39:28 -0700
committerAndrea Shepard <andrea@persephoneslair.org>2012-06-15 21:39:28 -0700
commit7f24b9b8c3d29143deb65dae34d2c35b940319e3 (patch)
treedb211ff912ff496d922e5444dc7181b9d2f33592 /src/or/rendclient.c
parenta8bcbe7bf7d826c5aa97bb1298669e9b41cbadc5 (diff)
downloadtor-7f24b9b8c3d29143deb65dae34d2c35b940319e3.tar.gz
tor-7f24b9b8c3d29143deb65dae34d2c35b940319e3.zip
Clean up keys on stack in rend_client_refetch_v2_renddesc()
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r--src/or/rendclient.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 39ba05a0a0..7208fb813b 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -674,10 +674,17 @@ rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
time(NULL), chosen_replica) < 0) {
log_warn(LD_REND, "Internal error: Computing v2 rendezvous "
"descriptor ID did not succeed.");
- return;
+ /*
+ * Hmm, can this write anything to descriptor_id and still fail?
+ * Let's clear it just to be safe.
+ *
+ * From here on, any returns should goto done which clears
+ * descriptor_id so we don't leave key-derived material on the stack.
+ */
+ goto done;
}
if (directory_get_from_hs_dir(descriptor_id, rend_query) != 0)
- return; /* either success or failure, but we're done */
+ goto done; /* either success or failure, but we're done */
}
/* If we come here, there are no hidden service directories left. */
log_info(LD_REND, "Could not pick one of the responsible hidden "
@@ -685,6 +692,10 @@ rend_client_refetch_v2_renddesc(const rend_data_t *rend_query)
"we already tried them all unsuccessfully.");
/* Close pending connections. */
rend_client_desc_trynow(rend_query->onion_address);
+
+done:
+ memset(descriptor_id, 0, sizeof(descriptor_id));
+
return;
}