Commit 9561597c authored by Steve Dower's avatar Steve Dower

Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls

parent b84e8b5f
...@@ -242,9 +242,12 @@ class MimeTypes: ...@@ -242,9 +242,12 @@ class MimeTypes:
i = 0 i = 0
while True: while True:
try: try:
yield _winreg.EnumKey(mimedb, i) ctype = _winreg.EnumKey(mimedb, i)
except EnvironmentError: except EnvironmentError:
break break
else:
if '\0' not in ctype:
yield ctype
i += 1 i += 1
default_encoding = sys.getdefaultencoding() default_encoding = sys.getdefaultencoding()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment