summaryrefslogtreecommitdiffstats
path: root/Lib/mimify.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-02-27 14:40:38 (GMT)
committerGuido van Rossum <guido@python.org>1998-02-27 14:40:38 (GMT)
commit13452644d59a5c9d4d39d4418b94250d4e1e68c1 (patch)
tree9d2b19f01167def0f0dbe45518ef881a8f734cf4 /Lib/mimify.py
parent8fa5eb8784f977914a27ca91c4658282827def17 (diff)
downloadcpython-13452644d59a5c9d4d39d4418b94250d4e1e68c1.zip
cpython-13452644d59a5c9d4d39d4418b94250d4e1e68c1.tar.gz
cpython-13452644d59a5c9d4d39d4418b94250d4e1e68c1.tar.bz2
Sjoerd writes: When a multipart message is incomplete, mimify crashes.
Diffstat (limited to 'Lib/mimify.py')
-rwxr-xr-xLib/mimify.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/mimify.py b/Lib/mimify.py
index fb79db7..2ed3d6a 100755
--- a/Lib/mimify.py
+++ b/Lib/mimify.py
@@ -179,6 +179,9 @@ def unmimify_part(ifile, ofile, decode_base64 = 0):
nifile = File(ifile, multipart)
unmimify_part(nifile, ofile, decode_base64)
line = nifile.peek
+ if not line:
+ # premature end of file
+ break
continue
# not a boundary between parts
break
@@ -390,6 +393,9 @@ def mimify_part(ifile, ofile, is_mime):
nifile = File(ifile, multipart)
mimify_part(nifile, ofile, 1)
line = nifile.peek
+ if not line:
+ # premature end of file
+ break
ofile.write(line)
continue