summaryrefslogtreecommitdiff
path: root/src/test/test_util.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-02-21 20:23:21 +0100
committerNick Mathewson <nickm@torproject.org>2018-03-28 07:39:03 -0400
commit6b6d003f43cbbf01b40cedb0cc12ada2e81461f9 (patch)
tree829218907a1870688faad805ede2eb890d82be73 /src/test/test_util.c
parentd891010fdd4562e29a5a468232cd7b30430d7570 (diff)
downloadtor-6b6d003f43cbbf01b40cedb0cc12ada2e81461f9.tar.gz
tor-6b6d003f43cbbf01b40cedb0cc12ada2e81461f9.zip
Don't explode on NULL or empty string
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r--src/test/test_util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/test_util.c b/src/test/test_util.c
index ee9b16494c..c734426a5a 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -5542,6 +5542,18 @@ test_util_max_mem(void *arg)
}
static void
+test_util_dest_validation_edgecase(void *arg)
+{
+ (void)arg;
+
+ tt_assert(!string_is_valid_dest(NULL));
+ tt_assert(!string_is_valid_dest(""));
+
+ done:
+ return;
+}
+
+static void
test_util_hostname_validation(void *arg)
{
(void)arg;
@@ -6222,6 +6234,7 @@ struct testcase_t util_tests[] = {
&passthrough_setup, (void*)"1" },
UTIL_TEST(max_mem, 0),
UTIL_TEST(hostname_validation, 0),
+ UTIL_TEST(dest_validation_edgecase, 0),
UTIL_TEST(ipv4_validation, 0),
UTIL_TEST(writepid, 0),
UTIL_TEST(get_avail_disk_space, 0),