]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix replacements to sanitize '%' character
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 29 Nov 2016 11:29:13 +0000 (11:29 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 29 Nov 2016 11:29:13 +0000 (11:29 +0000)
src/plugins/lua/spamassassin.lua

index c2b3dd1d2cb4b6bb497435b34bbdd2c50bd4c7a7..c71fe12eb73a2349e6766cad16364778d9f3a0e9 100644 (file)
@@ -1101,8 +1101,9 @@ local function apply_replacements(str)
     local sstr
     sstr = s
     fun.each(function(n, t)
-        sstr = string.gsub(sstr, 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 sstr