[Mimedefang] [PATCH] Spamassassin fix for mails with masses of newlines

Martin Blapp mb at imp.ch
Thu Sep 16 08:41:07 EDT 2004


Hi all,

Previous patch had 2 uncessary lines. This one is more correct:

--- lib/Mail/SpamAssassin/Message.pm    Thu Sep  9 20:29:19 2004
+++ lib/Mail/SpamAssassin/Message.pm    Thu Sep 16 12:50:54 2004
@@ -197,10 +197,12 @@
   # will get modified below
   $self->{'pristine_body'} = join('', @message);

-  # CRLF -> LF
-  for ( @message ) {
-    s/\r\n/\n/;
-  }
+  # Remove repeated empty lines and convert CRLF to LF
+  # This saves us a lot of mem.
+  my $tmpmsg = join('', $self->{'pristine_body'});
+  $tmpmsg =~ s/\r\n/\n/gs;
+  $tmpmsg =~ s/\n{100,}/\n/gs;
+  @message = split ( /^/m, $tmpmsg );

   # If the message does need to get parsed, save off a copy of the body
   # in a format we can easily parse later so we don't have to rip from

Martin



More information about the MIMEDefang mailing list