aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-01-17 13:32:19 -0500
committerNick Mathewson <nickm@torproject.org>2019-01-17 13:32:19 -0500
commitf632335feb27b45a3ee5eb64690826bda52467bd (patch)
treea60fca8562c6beafcaae1de678fcefaecbeeb26d /src/feature/hs/hs_common.c
parent22c5ad682cdd2e6a9a2124585302b2335361ab80 (diff)
downloadtor-f632335feb27b45a3ee5eb64690826bda52467bd.tar.gz
tor-f632335feb27b45a3ee5eb64690826bda52467bd.zip
Fix users of base32_decode to check for expected length in return.
Also, when we log about a failure from base32_decode(), we now say that the length is wrong or that the characters were invalid: previously we would just say that there were invalid characters. Follow-up on 28913 work.
Diffstat (limited to 'src/feature/hs/hs_common.c')
-rw-r--r--src/feature/hs/hs_common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index 8dbd9485ea..97229ac11e 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -926,7 +926,8 @@ hs_parse_address(const char *address, ed25519_public_key_t *key_out,
}
/* Decode address so we can extract needed fields. */
- if (base32_decode(decoded, sizeof(decoded), address, strlen(address)) < 0) {
+ if (base32_decode(decoded, sizeof(decoded), address, strlen(address))
+ != sizeof(decoded)) {
log_warn(LD_REND, "Service address %s can't be decoded.",
escaped_safe_str(address));
goto invalid;