aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-08-02 21:17:20 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-08-02 21:17:20 +0100
commit05c186a485f9b07680f6cb1d0e44039a37a400bf (patch)
tree25de63b85e8dde1ff5d77edf01afc25bbc9481d6 /lualib
parent2249d428bd8f27d8e952233c4a15a75f69b12316 (diff)
downloadrspamd-05c186a485f9b07680f6cb1d0e44039a37a400bf.tar.gz
rspamd-05c186a485f9b07680f6cb1d0e44039a37a400bf.zip
[Minor] Consider subject when checking hash function input length
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_fuzzy.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/lualib/lua_fuzzy.lua b/lualib/lua_fuzzy.lua
index ce4ac55ee..332e828ac 100644
--- a/lualib/lua_fuzzy.lua
+++ b/lualib/lua_fuzzy.lua
@@ -131,6 +131,13 @@ local function check_length(task, part, rule)
-- However, in the case of empty parts this method returns `nil`, so extra
-- sanity check is required.
bytes = #(part:get_text():get_content_oneline() or '')
+
+ -- Short hashing algorithm also use subject unless explicitly denied
+ if not rule.no_subject then
+ local subject = task:get_subject() or ''
+ bytes = bytes + #subject
+ end
+
if rule.text_multiplier then
adjusted_bytes = bytes * rule.text_multiplier
end