summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-02-11 16:39:23 +0100
committerNick Mathewson <nickm@torproject.org>2018-03-28 07:39:03 -0400
commit1af016e96e133718546b55c8b7fafd3345aaeeb8 (patch)
treea877524cac58faf93e1fe622b968013932402e3e /src/test/test_util.c
parent0e453929d21b030832b0c48fceac0c5688657e15 (diff)
downloadtor-1af016e96e133718546b55c8b7fafd3345aaeeb8.tar.gz
tor-1af016e96e133718546b55c8b7fafd3345aaeeb8.zip
Do not consider IP strings valid DNS names. Fixes #25055
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index b67fad58e3..2fa03e5bc7 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -5584,6 +5584,11 @@ test_util_hostname_validation(void *arg)
tt_assert(!string_is_valid_hostname("."));
tt_assert(!string_is_valid_hostname(".."));
+ // IP address strings are not hostnames.
+ tt_assert(!string_is_valid_hostname("8.8.8.8"));
+ tt_assert(!string_is_valid_hostname("[2a00:1450:401b:800::200e]"));
+ tt_assert(!string_is_valid_hostname("2a00:1450:401b:800::200e"));
+
done:
return;
}