Re: [AMaViS-user] Long bad whitespace-lines - PATCH

This is a discussion on Re: [AMaViS-user] Long bad whitespace-lines - PATCH within the Amavis User forums, part of the Anti-Spam and Anti-Virus Related Forums category; everybody, On Wednesday September 5 2007 03:53:44 Mark Martinec wrote: > > I got one sample myself. It ...


Go Back   Usenet Forums > Anti-Spam and Anti-Virus Related Forums > Amavis User

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-10-2007
Mark Martinec
 
Posts: n/a
Default Re: [AMaViS-user] Long bad whitespace-lines - PATCH

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]+ | \[ (?: \\. | [^\]\\] )* \]
- | [^@] )* )? \z}xs) {
+ if ($addr =~ m{^ ( .*? )
+ ( \@ (?: [^@\[\]]+ | \[ (?: \\. | [^\]\\] )* \] | [^@] )* )?
+ \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
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/...fo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:47 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0