From 3890ad25787ad6142acd65d064168ead53e9a289 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Tue, 28 Aug 2018 18:32:31 +0300 Subject: Stricter HiddenServicePort parsing --- src/feature/rend/rendservice.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/feature/rend') diff --git a/src/feature/rend/rendservice.c b/src/feature/rend/rendservice.c index 1a99bd56ed..beb0040e5f 100644 --- a/src/feature/rend/rendservice.c +++ b/src/feature/rend/rendservice.c @@ -451,11 +451,19 @@ rend_service_parse_port_config(const char *string, const char *sep, int is_unix; ret = port_cfg_line_extract_addrport(addrport_element, &addrport, &is_unix, &rest); + if (ret < 0) { tor_asprintf(&err_msg, "Couldn't process address <%s> from hidden " "service configuration", addrport_element); goto err; } + + if (rest && strlen(rest)) { + err_msg = tor_strdup("HiddenServicePort parse error: invalid port " + "mapping"); + goto err; + } + if (is_unix) { socket_path = addrport; is_unix_addr = 1; -- cgit v1.2.3-54-g00ecf