[Python-checkins] cpython (3.4): Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls

steve.dower python-checkins at python.org
Tue Mar 10 21:20:59 CET 2015


https://hg.python.org/cpython/rev/bf2016a1911f
changeset:   94935:bf2016a1911f
branch:      3.4
parent:      94930:869eff562b55
user:        Steve Dower <steve.dower at microsoft.com>
date:        Tue Mar 10 13:17:21 2015 -0700
summary:
  Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls

files:
  Lib/mimetypes.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


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:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list