You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2020/01/16 07:14:23 UTC

svn commit: r1872861 - in /spamassassin: branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm

Author: hege
Date: Thu Jan 16 07:14:23 2020
New Revision: 1872861

URL: http://svn.apache.org/viewvc?rev=1872861&view=rev
Log:
Use compiled patterns

Modified:
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm?rev=1872861&r1=1872860&r2=1872861&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm Thu Jan 16 07:14:23 2020
@@ -89,9 +89,9 @@ sub do_one_line_body_tests {
     loop_body => sub
   {
     my ($self, $pms, $conf, $rulename, $pat, %opts) = @_;
-    $pat = untaint_var($pat);
     my $sub = '
       my ($self, $line) = @_;
+      my $qrptr = $self->{main}->{conf}->{test_qrs};
     ';
 
     if (($conf->{tflags}->{$rulename}||'') =~ /\bmultiple\b/)
@@ -111,7 +111,7 @@ sub do_one_line_body_tests {
       my $lref = \$line;
       pos $$lref = 0;
       '.$self->hash_line_for_rule($pms, $rulename).'
-      while ($$lref =~ '.$pat.'g) {
+      while ($$lref =~ /$qrptr->{q{'.$rulename.'}}/go) {
         $self->got_hit(q{'.$rulename.'}, "BODY: ", ruletype => "one_line_body");
         '. $self->hit_rule_plugin_code($pms, $rulename, "one_line_body", "") . '
         '. ($max? 'last if $self->{tests_already_hit}->{q{'.$rulename.'}} >= '.$max.';' : '') . '
@@ -121,7 +121,7 @@ sub do_one_line_body_tests {
     } else {
       $sub .= '
       '.$self->hash_line_for_rule($pms, $rulename).'
-      if ($line =~ '.$pat.') {
+      if ($line =~ /$qrptr->{q{'.$rulename.'}}/o) {
         $self->got_hit(q{'.$rulename.'}, "BODY: ", ruletype => "one_line_body");
         '. $self->hit_rule_plugin_code($pms, $rulename, "one_line_body", "return 1") . '
       }

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm?rev=1872861&r1=1872860&r2=1872861&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/OneLineBodyRuleType.pm Thu Jan 16 07:14:23 2020
@@ -89,9 +89,9 @@ sub do_one_line_body_tests {
     loop_body => sub
   {
     my ($self, $pms, $conf, $rulename, $pat, %opts) = @_;
-    $pat = untaint_var($pat);
     my $sub = '
       my ($self, $line) = @_;
+      my $qrptr = $self->{main}->{conf}->{test_qrs};
     ';
 
     if (($conf->{tflags}->{$rulename}||'') =~ /\bmultiple\b/)
@@ -111,7 +111,7 @@ sub do_one_line_body_tests {
       my $lref = \$line;
       pos $$lref = 0;
       '.$self->hash_line_for_rule($pms, $rulename).'
-      while ($$lref =~ '.$pat.'g) {
+      while ($$lref =~ /$qrptr->{q{'.$rulename.'}}/gop) {
         $self->got_hit(q{'.$rulename.'}, "BODY: ", ruletype => "one_line_body");
         '. $self->hit_rule_plugin_code($pms, $rulename, "one_line_body", "") . '
         '. ($max? 'last if $self->{tests_already_hit}->{q{'.$rulename.'}} >= '.$max.';' : '') . '
@@ -121,7 +121,7 @@ sub do_one_line_body_tests {
     } else {
       $sub .= '
       '.$self->hash_line_for_rule($pms, $rulename).'
-      if ($line =~ '.$pat.') {
+      if ($line =~ /$qrptr->{q{'.$rulename.'}}/op) {
         $self->got_hit(q{'.$rulename.'}, "BODY: ", ruletype => "one_line_body");
         '. $self->hit_rule_plugin_code($pms, $rulename, "one_line_body", "return 1") . '
       }