From 19e9e19dfd461154f7d05d8a8bf00b4ff1a4d7e1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 29 Nov 2016 11:29:13 +0000 Subject: [Fix] Fix replacements to sanitize '%' character --- src/plugins/lua/spamassassin.lua | 5 +++-- 1 file 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 -- cgit v1.2.3