[Mailman-Users] Exception in ScanMessage for MIME messages with missing boundary

Harald Meland Harald.Meland at usit.uio.no
Wed Jun 16 20:23:30 CEST 1999


[Ian Jackson]

> (Is this the right place to report bugs ?)

The preferred way of reporting is to use the Mailman Jitterbug
interface at <URL:http://www.python.org/mailman-bugs/>.

> One of the lists on my system received a bounce with an empty body,
> but with Content-Type: multipart/report.  When Mailman tried to parse
> it it got an exception because it couldn't find the message boundary.

Here's a quick patch:

Index: Bouncer.py
===================================================================
RCS file: /export/public/cvsroot/mailman/Mailman/Bouncer.py,v
retrieving revision 1.32
diff -u -r1.32 Bouncer.py
--- Bouncer.py	1999/03/10 13:10:14	1.32
+++ Bouncer.py	1999/06/16 18:22:21
@@ -332,7 +332,12 @@
                                         '"[^"]+"')[1][1:-1]
 
 	if boundry:
-	    relevant_text = string.split(msg.body, '--%s' % boundry)[1]
+	    relevant_text = string.split(msg.body, '--%s' % boundry)
+            # Invalid MIME messages shouldn't cause exceptions
+            if len(relevant_text) >= 2:
+                relevant_text = relevant_text[1]
+            else:
+                relevant_text = relevant_text[0]
 	else:
 	    # This looks strange, but at least 2 are going to be no-ops.
 	    relevant_text = regsub.split(msg.body,
-- 
Harald




More information about the Mailman-Users mailing list