aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-07 08:44:39 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-07 08:44:39 -0400
commita5ed62f96cafa1be251f9a7b4aafa519de4c2645 (patch)
tree0d8127b923959622711c576a5dd5fb23b2f2422d /src
parenta08e6e711fbcd6a12818f1fe14739fc0e870434d (diff)
parent912ae2b8dc5d13344035def71c6e083a92752c09 (diff)
downloadtor-a5ed62f96cafa1be251f9a7b4aafa519de4c2645.tar.gz
tor-a5ed62f96cafa1be251f9a7b4aafa519de4c2645.zip
Merge branch 'maint-0.2.9' into maint-0.3.2
Diffstat (limited to 'src')
-rw-r--r--src/or/rendclient.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 3274819241..ac2ac5be21 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -238,6 +238,15 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
dh_offset = v3_shift+7+DIGEST_LEN+2+klen+REND_COOKIE_LEN;
} else {
/* Version 0. */
+
+ /* Some compilers are smart enough to work out that nickname can be more
+ * than 19 characters, when it's a hexdigest. They warn that strncpy()
+ * will truncate hexdigests without NUL-terminating them. But we only put
+ * hexdigests in HSDir and general circuit exits. */
+ if (BUG(strlen(rendcirc->build_state->chosen_exit->nickname)
+ > MAX_NICKNAME_LEN)) {
+ goto perm_err;
+ }
strncpy(tmp, rendcirc->build_state->chosen_exit->nickname,
(MAX_NICKNAME_LEN+1)); /* nul pads */
memcpy(tmp+MAX_NICKNAME_LEN+1, rendcirc->rend_data->rend_cookie,