diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-30 18:17:44 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-10-30 18:17:44 +0000 |
commit | ab791a5622c0ad6dc5d47bc2a858813b12f005fa (patch) | |
tree | 309a911f6932bbdc3b6fa154a58c42632f3c43a4 /lualib | |
parent | 2bbf8bb78e8e9d5566d1c1b4812cf6a8258033ef (diff) | |
download | rspamd-ab791a5622c0ad6dc5d47bc2a858813b12f005fa.tar.gz rspamd-ab791a5622c0ad6dc5d47bc2a858813b12f005fa.zip |
[Minor] Lua_mime: Some more issue fixed
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/lua_mime.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lualib/lua_mime.lua b/lualib/lua_mime.lua index 76e3c6195..0019d7622 100644 --- a/lualib/lua_mime.lua +++ b/lualib/lua_mime.lua @@ -340,8 +340,8 @@ local function do_replacement (task, part, mp, replacements, end -- Off-by one: match returns 0 based positions while we use 1 based in Lua for _,m in ipairs(matches_flattened) do - m[1][1] = m[1][1] - 1 - m[1][2] = m[1][2] - 1 + m[1][1] = m[1][1] + 1 + m[1][2] = m[1][2] + 1 end -- Now flattened match table is sorted by start pos and has the maximum overlapped pattern @@ -353,8 +353,8 @@ local function do_replacement (task, part, mp, replacements, local cur_start = 1 local fragments = {} for _,m in ipairs(matches_flattened) do - if m[1][1] > cur_start then - fragments[#fragments + 1] = content:sub(cur_start, m[1][1]) + if m[1][1] >= cur_start then + fragments[#fragments + 1] = content:sub(cur_start, m[1][1] - 1) fragments[#fragments + 1] = replacements[m[2]] cur_start = m[1][2] + 1 -- end of match end |