[Python-checkins] cpython (merge 3.4 -> default): 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/6ccade563bf7
changeset:   94936:6ccade563bf7
parent:      94934:499be67e3dcb
parent:      94935:bf2016a1911f
user:        Steve Dower <steve.dower at microsoft.com>
date:        Tue Mar 10 13:20: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