# HG changeset patch # Parent 3b1c44248635e9b3eaa158d70e9efc8d701b5c5a #22028: Ensure mimetypes will not open registry keys with embedded nulls diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -246,7 +246,8 @@ except EnvironmentError: break else: - yield ctype + if '\0' not in ctype: + yield ctype i += 1 with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr: