]> source.dussan.org Git - rspamd.git/commitdiff
If replacement cannot be applied, just remove regexp.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 May 2015 16:37:45 +0000 (17:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 May 2015 16:38:30 +0000 (17:38 +0100)
src/plugins/lua/spamassassin.lua

index 9c25b67b601a7641d8ee3ea2a866f58e2f31ad3c..1fc175b0b7e016d98e20e115b2f2ceda8cb850a9 100644 (file)
@@ -524,6 +524,9 @@ end
 
 local function sa_regexp_match(data, re, raw, rule)
   local res = 0
+  if not re then
+    return 0
+  end
   if rule['multiple'] then
     local lim = -1
     if rule['maxhits'] then
@@ -628,6 +631,7 @@ _.each(function(r)
       local nre = rspamd_regexp.create_cached(nexpr)
       if not nre then
         rspamd_logger.errx('cannot apply replacement for rule %1', r)
+        rule['re'] = nil
       else
         rspamd_logger.debugx('replace %1 -> %2', r, nexpr)
         rule['re'] = nre