commit dde092e: [Minor] Fix checks safety

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 19 09:28:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-19 10:23:44 +0100
URL: https://github.com/rspamd/rspamd/commit/dde092ef09cddfae6bd1d70977d5208bb88d2d7f (HEAD -> master)

[Minor] Fix checks safety

---
 rules/html.lua | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rules/html.lua b/rules/html.lua
index 97a6b2372..58fabfd7a 100644
--- a/rules/html.lua
+++ b/rules/html.lua
@@ -214,10 +214,12 @@ local vis_check_id = rspamd_config:register_symbol{
               local tr = transp_len / (normal_len + transp_len)
               if tr > transp_rate then
                 transp_rate = tr
+                if not bl.color then bl.color = {0, 0, 0} end
+                if not bl.bgcolor then bl.bgcolor = {0, 0, 0} end
                 arg = string.format('%s color #%x%x%x bgcolor #%x%x%x',
                     tag:get_type(),
-                    bl.color[1] or 0, bl.color[2] or 0, bl.color[3] or 0,
-                    bl.bgcolor[1] or 0, bl.bgcolor[2] or 0, bl.bgcolor[3] or 0)
+                    bl.color[1], bl.color[2], bl.color[3],
+                    bl.bgcolor[1], bl.bgcolor[2], bl.bgcolor[3])
               end
             end
           end


More information about the Commits mailing list