Fix SIGSEGV in test-is-public-all.c for TLD exceptions

This commit is contained in:
Tim Rühsen 2015-09-15 12:19:18 +02:00
parent f6a3b96f91
commit 0652af910e
1 changed files with 6 additions and 4 deletions

View File

@ -80,11 +80,13 @@ static void test_psl(void)
printf("psl_is_public_suffix(%s)=%d (expected 0)\n", p, result); printf("psl_is_public_suffix(%s)=%d (expected 0)\n", p, result);
} else ok++; } else ok++;
if (!(result = psl_is_public_suffix(psl, strchr(p, '.') + 1))) { if ((p = strchr(p, '.'))) {
if (!(result = psl_is_public_suffix(psl, p + 1))) {
failed++; failed++;
printf("psl_is_public_suffix(%s)=%d (expected 1)\n", strchr(p, '.') + 1, result); printf("psl_is_public_suffix(%s)=%d (expected 1)\n", p + 1, result);
} else ok++; } else ok++;
} }
}
else if (*p == '*') { /* a wildcard, e.g. *.ck */ else if (*p == '*') { /* a wildcard, e.g. *.ck */
if (!(result = psl_is_public_suffix(psl, p + 1))) { if (!(result = psl_is_public_suffix(psl, p + 1))) {
failed++; failed++;