From 6f5f38a0bc60d3be9b6cf02e29b9065869cf6af8 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 21 Apr 2015 14:04:39 -0400 Subject: Add function to validate HS descriptor ID Signed-off-by: David Goulet --- src/or/routerparse.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/or/routerparse.c') diff --git a/src/or/routerparse.c b/src/or/routerparse.c index fd3971c587..14d5f75e35 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -4572,8 +4572,7 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, tok = find_by_keyword(tokens, R_RENDEZVOUS_SERVICE_DESCRIPTOR); tor_assert(tok == smartlist_get(tokens, 0)); tor_assert(tok->n_args == 1); - if (strlen(tok->args[0]) != REND_DESC_ID_V2_LEN_BASE32 || - strspn(tok->args[0], BASE32_CHARS) != REND_DESC_ID_V2_LEN_BASE32) { + if (!rend_valid_descriptor_id(tok->args[0])) { log_warn(LD_REND, "Invalid descriptor ID: '%s'", tok->args[0]); goto err; } -- cgit v1.2.3-54-g00ecf