summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-03-10 20:20:21 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-03-10 20:20:21 (GMT)
commit12541dc22ef3bbc2469b910eeb8daa4cd5675873 (patch)
tree270675cb672242fa354c1cc48f2b75a67cc265ff /Lib
parent3d3aaa1eabee1f71045142fd46a4a213f921b1fb (diff)
parentebb8c2d528e07df71c345826fc1290327b1e369e (diff)
downloadcpython-12541dc22ef3bbc2469b910eeb8daa4cd5675873.zip
cpython-12541dc22ef3bbc2469b910eeb8daa4cd5675873.tar.gz
cpython-12541dc22ef3bbc2469b910eeb8daa4cd5675873.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: