From 13452644d59a5c9d4d39d4418b94250d4e1e68c1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 27 Feb 1998 14:40:38 +0000 Subject: Sjoerd writes: When a multipart message is incomplete, mimify crashes. --- Lib/mimify.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v0.12