[Python-checkins] cpython (2.7): Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls
steve.dower
python-checkins at python.org
Tue Mar 10 21:20:41 CET 2015
https://hg.python.org/cpython/rev/7c4c4e43c452
changeset: 94933:7c4c4e43c452
branch: 2.7
parent: 94909:17253605eca4
user: Steve Dower <steve.dower at microsoft.com>
date: Tue Mar 10 13:19:17 2015 -0700
summary:
Issue #22028: Ensure mimetypes will not open registry keys with embedded nulls
files:
Lib/mimetypes.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -242,9 +242,12 @@
i = 0
while True:
try:
- yield _winreg.EnumKey(mimedb, i)
+ ctype = _winreg.EnumKey(mimedb, i)
except EnvironmentError:
break
+ else:
+ if '\0' not in ctype:
+ yield ctype
i += 1
default_encoding = sys.getdefaultencoding()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list