From: Steve Dower Date: Tue, 10 Mar 2015 20:17:21 +0000 (-0700) Subject: Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls X-Git-Tag: v3.5.0a3~207^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ebb8c2d528e07df71c345826fc1290327b1e369e;p=thirdparty%2FPython%2Fcpython.git Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls --- diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index b98c8749f632..d64726b80fbb 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: