]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Consider subject when checking hash function input length
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 2 Aug 2022 20:17:20 +0000 (21:17 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 2 Aug 2022 20:17:20 +0000 (21:17 +0100)
lualib/lua_fuzzy.lua

index ce4ac55ee7f67c7761f0787f6d3d0a6929e6ff14..332e828ac993d908bacf6b663cddc5315d0359e2 100644 (file)
@@ -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