aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-01-19 17:10:58 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-01-19 17:11:26 +0000
commit9908a4360a4433d02f45e4cd3f7e8bb380e77594 (patch)
treead337bc52041e77089aef2996321090105fa6695 /lualib/rspamadm
parentf9115a80e5e69e43c019c4d667b44c3021578257 (diff)
downloadrspamd-9908a4360a4433d02f45e4cd3f7e8bb380e77594.tar.gz
rspamd-9908a4360a4433d02f45e4cd3f7e8bb380e77594.zip
[Minor] Rspamadm fix use after free
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r--lualib/rspamadm/mime.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua
index 6294f373f..8bd2478c8 100644
--- a/lualib/rspamadm/mime.lua
+++ b/lualib/rspamadm/mime.lua
@@ -266,6 +266,7 @@ end
local function extract_handler(opts)
local out_elts = {}
+ local tasks = {}
local process_func
if opts.words then
@@ -415,11 +416,12 @@ local function extract_handler(opts)
end
table.insert(out_elts[fname], "")
-
- task:destroy() -- No automatic dtor
+ table.insert(tasks, task)
end
print_elts(out_elts, opts, process_func)
+ -- To avoid use after free we postpone tasks destruction
+ for _,task in ipairs(tasks) do task:destroy() end
end
local function stat_handler(opts)