]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix replacements to sanitize '%' character 1203/head
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 29 Nov 2016 11:29:13 +0000 (11:29 +0000)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 29 Nov 2016 12:03:31 +0000 (14:03 +0200)
Conflicts:
src/plugins/lua/spamassassin.lua

src/plugins/lua/spamassassin.lua

index 1019dd3933e61a0229f8057748ea09053afe7347..27940212a801ec9e2a428c04e8dfaf0e3f523eab 100644 (file)
@@ -1068,14 +1068,15 @@ local function apply_replacements(str)
   end
 
   local function replace_all_tags(s)
-    local str, matches
-    str = s
+    local sstr
+    sstr = s
     each(function(n, t)
-        str,matches = string.gsub(str, string.format("<%s>", n),
-          string.format("%s%s%s", pre, t, post))
+      local rep = string.format("%s%s%s", pre, t, post)
+      rep = string.gsub(rep, '%%', '%%%%')
+      sstr = string.gsub(sstr, string.format("<%s>", n), rep)
     end, replace['tags'])
 
-    return str
+    return sstr
   end
 
   local s = replace_all_tags(str)