[Python-bugs-list] [ python-Bugs-836293 ] email generator can give bad output

SourceForge.net noreply at sourceforge.net
Wed Nov 5 07:52:10 EST 2003


Bugs item #836293, was opened at 2003-11-05 01:26
Message generated for change (Settings changed) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=836293&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: John Draper (crunch)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email generator can give bad output

Initial Comment:
#!/usr/bin/env python
#Feedback to crunch at shopip.com
#Python 2.3.2 under OpenBSD 3.4 i386
import email

print r"""
Example of Python email generator bug.
If a MIME message is missing the terminating line, the
generator creates one for it -only it forgets to add the
\n\n to it. This causes the following message to be
concatenated to the first.
"""

#s1 is MIME missing terminating line;
#s2 is a proper MIME message.
s1="""Received: by spameater (127.0.0.1)...
From: "Victor Virus" <security at microsoft.com>
To: <poorsap at host.net>
Subject: Unterminated MIME to corrupt your mbox!
MIME-Version: 1.0
Content-Type: multipart/mixed;boundary="xxxx"

--xxxx
Content-Type: text/plain;

This is an unterminated MIME, like many viruses
generate. I don't care about rights of viruses,
but I do care if improper handling of MIME causes
following messages to be lost.

--xxxx


"""
s2=s1+"""--xxxx--\n\n""" #Create properly terminator
msg1=email.message_from_string(s1)
msg2=email.message_from_string(s2)
print str(msg1)+str(msg2)
print "p.s. Notice how the first message runs into the"
print "      second message."
print "      By adding the missing '--', this won't happen."

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=836293&group_id=5470



More information about the Python-bugs-list mailing list