commit 50c6b04: [Minor] Initialise table first

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Mar 1 14:14:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-01 14:08:45 +0000
URL: https://github.com/rspamd/rspamd/commit/50c6b049c58f561ea60d7436bd6fc27ce64d827d (HEAD -> master)

[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 302861755..59d97fcd4 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


More information about the Commits mailing list