commit f5299d5: [Minor] Add limit for number of files processed in archives

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Apr 28 14:56:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-28 15:48:57 +0100
URL: https://github.com/rspamd/rspamd/commit/f5299d51ba510e7db5a3fac7861eadcd2316499b (HEAD -> master)

[Minor] Add limit for number of files processed in archives

---
 lualib/lua_magic/heuristics.lua | 2 +-
 lualib/lua_scanners/common.lua  | 2 +-
 src/plugins/lua/mime_types.lua  | 2 +-
 src/plugins/lua/multimap.lua    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index 8aeafae90..c60824bd8 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -267,7 +267,7 @@ local function detect_archive_flaw(part, arch, log_obj)
 
   if arch_type == 'zip' then
     -- Find specific files/folders in zip file
-    local files = arch:get_files() or {}
+    local files = arch:get_files(100) or {}
     for _,file in ipairs(files) do
       if file == '[Content_Types].xml' then
         add_msoffice_confidence(10)
diff --git a/lualib/lua_scanners/common.lua b/lualib/lua_scanners/common.lua
index 5c298b46f..60e5c2cdf 100644
--- a/lualib/lua_scanners/common.lua
+++ b/lualib/lua_scanners/common.lua
@@ -411,7 +411,7 @@ local function check_parts_match(task, rule)
       -- check filenames in archives
       if p:is_archive() then
         local arch = p:get_archive()
-        local filelist = arch:get_files_full()
+        local filelist = arch:get_files_full(1000)
         for _,f in ipairs(filelist) do
           ext,ext2 = gen_extension(f.name)
           if match_filter(task, ext, rule.mime_parts_filter_ext)
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 863e3a31a..6cf306b2b 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -434,7 +434,7 @@ local function check_mime_type(task)
           end
 
           if check then
-            local fl = arch:get_files_full()
+            local fl = arch:get_files_full(1000)
 
             local nfiles = #fl
 
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 876e96dc1..c3225ff25 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -877,7 +877,7 @@ local function multimap_callback(task, rule)
 
       for _,p in fun.iter(fun.filter(filter_parts, parts)) do
         if filter_archive(p) then
-          local fnames = p:get_archive():get_files()
+          local fnames = p:get_archive():get_files(1000)
 
           for _,fn in ipairs(fnames) do
             match_filename(rule, fn)


More information about the Commits mailing list