Another MIME decoder improvement, and script tags

Julian Field mailscanner at ecs.soton.ac.uk
Tue Mar 9 16:07:16 GMT 2004


For those of you who like to keep bang up to date on all these issues, I
have made another improvement to the MIME decoder which catches more rogue
MIME structures.

Please apply this to Message.pm:

-----SNIP-----
--- Message.pm.old 2004-03-08 18:35:44.000000000 +0000
+++ Message.pm 2004-03-09 10:01:52.000000000 +0000
@@ -1317,7 +1317,7 @@
        last unless defined $line;
        $nextpos += length $line;
        # Must have 2 lines of header
-      if ($prevline =~ /^[^:]+: / && $line =~ /(^\s+)|(^[^:]+ )|(^\s+.*=)/) {
+      if ($prevline =~ /^[^:\s]+: / && $line =~ /(^\s+)|(^[^:]+
)|(^\s+.*=)/) {
          #print STDERR "Found header start at \"$prevline\"\n and
\"$line\"\n";
          $foundheader = 1;
          last;
@@ -1333,7 +1333,9 @@
      }

      # Rewind to the start of the header
-    $file->setpos($prevpos);
+    #$file->setpos($prevpos);
+    seek $file, $prevpos, 0;
+    #print STDERR "First line is \"" . <$file> . "\"\n";

      # Setup everything for the MIME parser
      my $parser = MIME::Parser->new;
-----SNIP-----

I don't think this is urgent enough to warrant release now, it can go into
the pot for the next one.

While I'm here, how many of you would like me to squash <script> tags in
HTML messages?
--
Julian Field
www.MailScanner.info
MailScanner thanks transtec Computers for their support

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654



More information about the MailScanner mailing list