summaryrefslogtreecommitdiffstats
path: root/rules/misc.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-05-13 21:36:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-05-13 21:36:05 +0100
commit0b88d35b45dcea804e47a9236a5e0244b9b70c4e (patch)
treecaba1265f2963fcb5d82025976eacc1c9bc0c672 /rules/misc.lua
parent7f8d761d3a998c5f7b9912a430e760fb93f25032 (diff)
downloadrspamd-0b88d35b45dcea804e47a9236a5e0244b9b70c4e.tar.gz
rspamd-0b88d35b45dcea804e47a9236a5e0244b9b70c4e.zip
[Minor] Fix bit operations logic
Diffstat (limited to 'rules/misc.lua')
-rw-r--r--rules/misc.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index a7e77516d..2e5f38800 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -127,16 +127,17 @@ rspamd_config:register_symbol({
local obscured_id = rspamd_config:register_symbol{
callback = function(task)
local susp_urls = task:get_urls_filtered({ 'obscured', 'zw_spaces'})
- local obs_flag = url_flags_tab.obscured
- local zw_flag = url_flags_tab.zw_spaces
- if susp_urls then
+ if susp_urls and susp_urls[1] then
+ local obs_flag = url_flags_tab.obscured
+ local zw_flag = url_flags_tab.zw_spaces
+
for _,u in ipairs(susp_urls) do
local fl = u:get_flags_num()
- if bit.band(fl, obs_flag) then
+ if bit.band(fl, obs_flag) ~= 0 then
task:insert_result('R_SUSPICIOUS_URL', 1.0, u:get_host())
end
- if bit.band(fl, zw_flag) then
+ if bit.band(fl, zw_flag) ~= 0 then
task:insert_result('ZERO_WIDTH_SPACE_URL', 1.0, u:get_host())
end
end