summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-29 11:29:13 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-29 11:29:13 +0000
commit19e9e19dfd461154f7d05d8a8bf00b4ff1a4d7e1 (patch)
tree763aff1b4036d384309f1f585b3a9e1d415c3522
parentc16253d3c33de29be95afff1edf0fe44db446820 (diff)
downloadrspamd-19e9e19dfd461154f7d05d8a8bf00b4ff1a4d7e1.tar.gz
rspamd-19e9e19dfd461154f7d05d8a8bf00b4ff1a4d7e1.zip
[Fix] Fix replacements to sanitize '%' character
-rw-r--r--src/plugins/lua/spamassassin.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index c2b3dd1d2..c71fe12eb 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -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