static const unsigned char *wildcard_find_star(const unsigned char *pattern,
					       size_t pattern_len)
	{
	const unsigned char *star = memchr(pattern, '*', pattern_len);
	size_t dot_count = 0;
	const unsigned char *suffix_start;
	size_t suffix_length;
	if (star == NULL)
		return NULL;
	suffix_start = star + 1;
	suffix_length = (pattern + pattern_len) - (star + 1);
	if (!(valid_domain_characters(pattern, star - pattern) &&
	      valid_domain_characters(suffix_start, suffix_length)))
		return NULL;
	/* Check that the suffix matches at least two labels. */
	while (suffix_length)
		{
		if (*suffix_start == '.')
			++dot_count;
		++suffix_start;
		--suffix_length;
		}
	if (dot_count < 2)
		return NULL;
	return star;
	}