]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add limit for number of files processed in archives
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 28 Apr 2020 14:48:57 +0000 (15:48 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 28 Apr 2020 14:48:57 +0000 (15:48 +0100)
lualib/lua_magic/heuristics.lua
lualib/lua_scanners/common.lua
src/plugins/lua/mime_types.lua
src/plugins/lua/multimap.lua

index 8aeafae905f4f883dd389ba09358117ff7c47e3e..c60824bd80503fb8780b6e5e802e21ac47a6658f 100644 (file)
@@ -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)
index 5c298b46f46be6582cd504f23982143af797f734..60e5c2cdffc3cd9937c2e6abe990a69c356099ef 100644 (file)
@@ -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)
index 863e3a31a5171f7158cfb977cbd68b6afe059ba6..6cf306b2bb7ed0e33ec4300928c6738b3461f7dd 100644 (file)
@@ -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
 
index 876e96dc15dad5edf9fc2104e0afb5e6511fbc53..c3225ff254828b16ac4fd6daee02df555c5b93ad 100644 (file)
@@ -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)