From 0652af910e21896daeaa2c86ea2f64c6f2148541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Tue, 15 Sep 2015 12:19:18 +0200 Subject: [PATCH] Fix SIGSEGV in test-is-public-all.c for TLD exceptions --- tests/test-is-public-all.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test-is-public-all.c b/tests/test-is-public-all.c index 22e308a..0eec25d 100644 --- a/tests/test-is-public-all.c +++ b/tests/test-is-public-all.c @@ -80,10 +80,12 @@ static void test_psl(void) printf("psl_is_public_suffix(%s)=%d (expected 0)\n", p, result); } else ok++; - if (!(result = psl_is_public_suffix(psl, strchr(p, '.') + 1))) { - failed++; - printf("psl_is_public_suffix(%s)=%d (expected 1)\n", strchr(p, '.') + 1, result); - } else ok++; + if ((p = strchr(p, '.'))) { + if (!(result = psl_is_public_suffix(psl, p + 1))) { + failed++; + printf("psl_is_public_suffix(%s)=%d (expected 1)\n", p + 1, result); + } else ok++; + } } else if (*p == '*') { /* a wildcard, e.g. *.ck */ if (!(result = psl_is_public_suffix(psl, p + 1))) {