summaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-09 09:37:14 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-09 09:37:14 -0400
commita1a55a33c20364ccbc0540125d662203152a20c2 (patch)
tree997bb8ebefffbacc6928f435505a9d9fc3f5fded /src/app
parent03283c00d86f9affe9d369b3e0f116770d4e0ec6 (diff)
parent46998fc8fd008f780f9d0ce827b89afab3cb0210 (diff)
downloadtor-a1a55a33c20364ccbc0540125d662203152a20c2.tar.gz
tor-a1a55a33c20364ccbc0540125d662203152a20c2.zip
Merge branch 'bug26488'
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/config.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 28d2be5ec1..665732ea56 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -6458,6 +6458,23 @@ parse_dir_authority_line(const char *line, dirinfo_type_t required_type,
}
addrport = smartlist_get(items, 0);
smartlist_del_keeporder(items, 0);
+
+ const char *addrport_sep = strchr(addrport, ':');
+ if (!addrport_sep) {
+ log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s' "
+ "(':' not found)", addrport);
+ goto err;
+ }
+
+ address = tor_strndup(addrport, addrport_sep - addrport);
+ if (!string_is_valid_ipv4_address(address)) {
+ log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s' "
+ "(invalid IPv4 address)", address);
+ goto err;
+ }
+
+ tor_free(address);
+
if (addr_port_lookup(LOG_WARN, addrport, &address, NULL, &dir_port)<0) {
log_warn(LD_CONFIG, "Error parsing DirAuthority address '%s'", addrport);
goto err;