summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-03-20 14:42:17 (GMT)
committerGuido van Rossum <guido@python.org>1997-03-20 14:42:17 (GMT)
commitf789ee4a8606ef1c34f2f18389b46c9b54ee04ae (patch)
tree510d4883181ff92d1c1cae08f7eda4bb22805ca9
parent14d1c721d57016e8fb898e50a7f8cc95315e6c04 (diff)
downloadcpython-f789ee4a8606ef1c34f2f18389b46c9b54ee04ae.zip
cpython-f789ee4a8606ef1c34f2f18389b46c9b54ee04ae.tar.gz
cpython-f789ee4a8606ef1c34f2f18389b46c9b54ee04ae.tar.bz2
Avoid crashes with nested multipart/mixed parts.
-rwxr-xr-xLib/mimify.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/mimify.py b/Lib/mimify.py
index ce4c4ba..15f0981 100755
--- a/Lib/mimify.py
+++ b/Lib/mimify.py
@@ -367,7 +367,14 @@ def mimify_part(ifile, ofile, is_mime):
line = message_end
while multipart:
if line == multipart + '--\n':
- return
+ # read bit after the end of the last part
+ while 1:
+ line = ifile.readline()
+ if not line:
+ return
+ if must_quote_body:
+ line = mime_encode(line, 0)
+ ofile.write(line)
if line == multipart + '\n':
nifile = File(ifile, multipart)
mimify_part(nifile, ofile, 1)