Skip to content

Commit a6e7bb3

Browse files
bradh352danielleadams
authored andcommitted
deps: cares: cherry-pick b5a3d96
Original commit message: Asterisks should be allowed in host validation as CNAMEs may reference wildcard domains CloudFlare appears to use this logic in CNAMEs as per #42171 Fixes: c-ares/c-ares#457 Fix By: Brad House (@bradh352) PR-URL: #42216 Fixes: #42171 Fixes: #457 Refs: c-ares/c-ares#457 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 07d2ed6 commit a6e7bb3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

deps/cares/src/lib/ares_expand_name.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@ static int ares__isprint(int ch)
6464
* - underscores which are used in SRV records.
6565
* - Forward slashes such as are used for classless in-addr.arpa
6666
* delegation (CNAMEs)
67+
* - Asterisks may be used for wildcard domains in CNAMEs as seen in the
68+
* real world.
6769
* While RFC 2181 section 11 does state not to do validation,
6870
* that applies to servers, not clients. Vulnerabilities have been
6971
* reported when this validation is not performed. Security is more
7072
* important than edge-case compatibility (which is probably invalid
7173
* anyhow). */
7274
static int is_hostnamech(int ch)
7375
{
74-
/* [A-Za-z0-9-._/]
76+
/* [A-Za-z0-9-*._/]
7577
* Don't use isalnum() as it is locale-specific
7678
*/
7779
if (ch >= 'A' && ch <= 'Z')
@@ -80,7 +82,7 @@ static int is_hostnamech(int ch)
8082
return 1;
8183
if (ch >= '0' && ch <= '9')
8284
return 1;
83-
if (ch == '-' || ch == '.' || ch == '_' || ch == '/')
85+
if (ch == '-' || ch == '.' || ch == '_' || ch == '/' || ch == '*')
8486
return 1;
8587

8688
return 0;

0 commit comments

Comments
 (0)