aboutsummaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-05-03 09:26:17 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-05-03 09:26:17 -0400
commit90b840af60a43eb8f8f66080ff5f53dda9df717b (patch)
tree4201e5640c0c53067feacd436459a8af9957454d /src/or/control.c
parente0b1fd4d3da05701c0970dabd93010d6c7550d43 (diff)
downloadtor-90b840af60a43eb8f8f66080ff5f53dda9df717b.tar.gz
tor-90b840af60a43eb8f8f66080ff5f53dda9df717b.zip
control: Fix NULL pointer access in HS desc event
This was introduced 90562fc23a7ce61f3660b507d9991a27af2eae37 adding a code path where we pass a NULL pointer for the HSDir fingerprint to the control event subsystem. The HS desc failed function wasn't handling properly that pointer for a NULL value. Two unit tests are also added in this commit to make sure we handle properly the case of a NULL hsdir fingerprint and a NULL content as well. Fixes #22138 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 9b0d7c0007..65d29259ea 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -6924,6 +6924,11 @@ get_desc_id_from_query(const rend_data_t *rend_data, const char *hsdir_fp)
goto end;
}
+ /* Without a directory fingerprint at this stage, we can't do much. */
+ if (hsdir_fp == NULL) {
+ goto end;
+ }
+
/* OK, we have an onion address so now let's find which descriptor ID
* is the one associated with the HSDir fingerprint. */
for (replica = 0; replica < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS;