From: Vsevolod Stakhov Date: Tue, 29 Nov 2016 11:29:13 +0000 (+0000) Subject: [Fix] Fix replacements to sanitize '%' character X-Git-Tag: 1.4.1~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=19e9e19dfd461154f7d05d8a8bf00b4ff1a4d7e1;p=rspamd.git [Fix] Fix replacements to sanitize '%' character --- 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