From 50c6b049c58f561ea60d7436bd6fc27ce64d827d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 1 Mar 2019 14:08:45 +0000 Subject: [PATCH] [Minor] Initialise table first --- src/plugins/lua/arc.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua index 3028617552..59d97fcd44 100644 --- a/src/plugins/lua/arc.lua +++ b/src/plugins/lua/arc.lua @@ -91,6 +91,7 @@ local settings = { } local function parse_arc_header(hdr, target) + -- Split elements by ';' and trim spaces local arr = fun.totable(fun.map( function(val) return fun.totable(fun.map(lua_util.rspamd_str_trim, @@ -102,8 +103,9 @@ local function parse_arc_header(hdr, target) -- Now we have two tables in format: -- [sigs] -> [{sig1_elts}, {sig2_elts}...] for i,elts in ipairs(arr) do + if not target[i] then target[i] = {} end + -- Split by kv pair, like k=v fun.each(function(v) - if not target[i] then target[i] = {} end if v[1] and v[2] then target[i][v[1]] = v[2] end -- 2.47.3