commit 8c225e4: [Fix] Fix aliases in forged recipients and limit number of iterations
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu May 21 13:21:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-05-21 14:14:08 +0100
URL: https://github.com/rspamd/rspamd/commit/8c225e4eae4a093ed92533418c3cc1554ae7df77 (HEAD -> master)
[Fix] Fix aliases in forged recipients and limit number of iterations
---
src/plugins/lua/forged_recipients.lua | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/plugins/lua/forged_recipients.lua b/src/plugins/lua/forged_recipients.lua
index 8abc55a50..5869b784e 100644
--- a/src/plugins/lua/forged_recipients.lua
+++ b/src/plugins/lua/forged_recipients.lua
@@ -36,13 +36,21 @@ local function check_forged_headers(task)
if not smtp_rcpt then return end
if #smtp_rcpt == 0 then return end
- local mime_rcpt = task:get_recipients(2)
+
+ local mime_rcpt = task:get_recipients({'mime','orig'})
+
if not mime_rcpt then
return
elseif #mime_rcpt == 0 then
return
end
+
-- Find pair for each smtp recipient in To or Cc headers
+ -- This cycle has O(N^2) complexity so it is better to limit number of iterations
+ if #smtp_rcpt > 100 or #mime_rcpt > 100 then
+ return
+ end
+
for _,sr in ipairs(smtp_rcpt) do
res = false
for _,mr in ipairs(mime_rcpt) do
More information about the Commits
mailing list