Skip to content

Commit 358a4e1

Browse files
committed
multiple wildcards should raise exception
1 parent a02fea1 commit 358a4e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/ssl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,14 @@ def _dnsname_match(dn, hostname):
239239
raise CertificateError(
240240
"wildcard can only be present in left most segment: " + repr(dn))
241241

242+
if wildcards > 1:
243+
# Issue #17980: avoid denials of service by refusing more
244+
# than one wildcard per fragment. A survey of established
245+
# policy among SSL implementations showed it to be a
246+
# reasonable choice.
247+
raise CertificateError(
248+
"too many wildcards in certificate DNS name: " + repr(dn))
249+
242250
# speed up common case w/o wildcards
243251
if not wildcards:
244252
return dn.lower() == hostname.lower()

0 commit comments

Comments
 (0)