commit eba15e9: [Minor] Mime_types: Check extension existence

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Jun 11 16:00:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-11 16:56:58 +0100
URL: https://github.com/rspamd/rspamd/commit/eba15e9dce30c971aefb5b2f6cbf8d5690d6e427 (HEAD -> master)

[Minor] Mime_types: Check extension existence

---
 src/plugins/lua/mime_types.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 29470e4ea..981512a33 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -438,7 +438,7 @@ local function check_mime_type(task)
             local is_gen_split_rar = false
             if filename then
               local ext = gen_extension(filename)
-              is_gen_split_rar = string.match(ext, '^%d%d%d$') and arch:get_type() == 'rar'
+              is_gen_split_rar = ext and (string.match(ext, '^%d%d%d$')) and (arch:get_type() == 'rar')
             end
 
             local fl = arch:get_files_full(1000)
@@ -454,7 +454,7 @@ local function check_mime_type(task)
               end
 
               if f['name'] then
-                if is_gen_split_rar and gen_extension(f['name']) == 'exe' then
+                if is_gen_split_rar and (gen_extension(f['name']) or '') == 'exe' then
                   task:insert_result(settings['symbol_exe_in_gen_split_rar'], 1.0, f['name'])
                 else
                   check_filename(f['name'], nil,


More information about the Commits mailing list