everybody,

On Wednesday September 5 2007 03:53:44 Mark Martinec wrote:
> > I got one sample myself. It causes Perl process to exceed virtual memory
> > quota during evaluation of a regular expression in sub parse_received,
> > due to deep recursion. [...] I'll see what can be done better.
>
> Here is a better quick-fix, applies to 2.4.2 and later,
> including 2.5.*.  The 2.6.0-pre1 already includes this fix.

I came cross another sample, this time with a bad long From header field
with lots of spaces, which causes the same problem but in another code
section. Here is a new patch (includes the previously posted), please
apply it to 2.5.* to prevent badly broken mail (spam) from getting stuck
in a MTA queue:

--- amavisd.ori Mon Sep 10 02:02:39 2007
+++ amavisd     Mon Sep 10 02:03:44 2007
@@ -3020,5 +3020,6 @@
   $received =~ s/\n([ \t])/$1/g;  # unfold
   $received =~ s/[\n\r]//g;       # delete remaining newlines if any
-  my(%fields);
+  $received =~ s/[ \t]+/ /g;      # compress whitespace as a quickfix/bandaid
+  my(%fields);                    #   for deep recursion in regexp evaluation
   while ($received =~ m{\G\s*
             ( \b(from|by) \s+ ( (?: \[ (?: \\. | [^\]\\] )* \] | [^;\s\[] )+ )
@@ -3308,7 +3309,7 @@
     $source_route = $1; $addr = $2;
   }
-  if ($addr =~ m{^ (    (?: [^"@]+ | " (?: \\. | [^"\\] )* " | . )*? )
-                   ( \@ (?: [^"@\[\]\\ \t]+ | \[ (?: \\. | [^\]\\] )* \]
-                          | [EMAIL PROTECTED] )* )? \z}xs) {
+  if ($addr =~ m{^ ( .*? )
+                 ( \@ (?: [EMAIL PROTECTED] | \[ (?: \\. | [^\]\\] )* \] | 
[EMAIL PROTECTED] )* )?
+                 \z}xs) {
     ($localpart,$domain) = ($1,$2);
   } else {


Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to