]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls
authorSteve Dower <steve.dower@microsoft.com>
Tue, 10 Mar 2015 20:17:21 +0000 (13:17 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Tue, 10 Mar 2015 20:17:21 +0000 (13:17 -0700)
Lib/mimetypes.py

index b98c8749f63221bf4043b19b5fd8eb5a72390b90..d64726b80fbb54bee172a4dea8b24ae1e7b72bb4 100644 (file)
@@ -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: