From ebb8c2d528e07df71c345826fc1290327b1e369e Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Tue, 10 Mar 2015 13:17:21 -0700 Subject: [PATCH] Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls --- Lib/mimetypes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index b98c8749f63..d64726b80fb 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -246,7 +246,8 @@ class MimeTypes: except EnvironmentError: break else: - yield ctype + if '\0' not in ctype: + yield ctype i += 1 with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, '') as hkcr: