summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-03-10 20:17:21 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-03-10 20:17:21 (GMT)
commitebb8c2d528e07df71c345826fc1290327b1e369e (patch)
tree9739a7fbf0cce0001020c82c8e858b67ebb4e56b /Lib
parent7a82afee70425782d27f4ed2c6d0bad3aeb91f09 (diff)
downloadcpython-ebb8c2d528e07df71c345826fc1290327b1e369e.zip
cpython-ebb8c2d528e07df71c345826fc1290327b1e369e.tar.gz
cpython-ebb8c2d528e07df71c345826fc1290327b1e369e.tar.bz2
Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls
Diffstat (limited to 'Lib')
-rw-r--r--Lib/mimetypes.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index b98c874..d64726b 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: