From: Vsevolod Stakhov Date: Tue, 19 Jan 2021 17:10:58 +0000 (+0000) Subject: [Minor] Rspamadm fix use after free X-Git-Tag: 3.0~758 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9908a4360a4433d02f45e4cd3f7e8bb380e77594;p=thirdparty%2Frspamd.git [Minor] Rspamadm fix use after free --- diff --git a/lualib/rspamadm/mime.lua b/lualib/rspamadm/mime.lua index 6294f373fd..8bd2478c8a 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)