← Commit list

2535c4298f

Daniel Stenberg
Daniel Stenberg
2025-12-08
SUCCESS Duration: 219s

Subject

hostcheck: fail wildcard match if host starts with a dot

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/vtls/hostcheck.c+2 -2
@@ -92,8 +92,8 @@ static bool hostmatch(const char *hostname,
if(strncmp(pattern, "*.", 2))
return pmatch(hostname, hostlen, pattern, patternlen);
- /* detect IP address as hostname and fail the match if so */
- else if(Curl_host_is_ipnum(hostname))
+ /* detect host as IP address or starting with a dot and fail if so */
+ else if(Curl_host_is_ipnum(hostname) || (hostname[0] == '.'))
return FALSE;
/* We require at least 2 dots in the pattern to avoid too wide wildcard
tests/unit/unit1397.c+2 -0
@@ -39,6 +39,8 @@ static CURLcode test_unit1397(const char *arg)
};
static const struct testcase tests[] = {
+ {".hello.com", "*.hello.com", FALSE },
+ {"a.hello.com", "*.hello.com", TRUE },
{ "", "", FALSE },
{ "a", "", FALSE },
{ "", "b", FALSE },