]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] CHECK_FROM rule: avoid indexing of nil
authorAndrew Lewis <nerf@judo.za.org>
Wed, 17 Jan 2018 16:41:44 +0000 (18:41 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 24 Jan 2018 12:14:05 +0000 (14:14 +0200)
rules/headers_checks.lua

index 37ec044ecac756eb28d890ac9bc085cf495704a6..8448fad960d2dda0508dcb5e9687809b94f2eebf 100644 (file)
@@ -593,11 +593,11 @@ local check_from_id = rspamd_config:register_symbol{
     then
       task:insert_result('FROM_EQ_ENVFROM', 1.0)
     elseif (envfrom and envfrom[1] and envfrom[1].addr) then
-      task:insert_result('FROM_NEQ_ENVFROM', 1.0, from and from[1].addr or '', envfrom[1].addr)
+      task:insert_result('FROM_NEQ_ENVFROM', 1.0, ((from or E)[1] or E).addr or '', envfrom[1].addr)
     end
 
     local to = task:get_recipients(2)
-    if not (to and to[1] and #to == 1 and from) then return false end
+    if not (to and to[1] and #to == 1 and from and from[1]) then return false end
     -- Check if FROM == TO
     if (util.strequal_caseless(to[1].addr, from[1].addr)) then
       task:insert_result('TO_EQ_FROM', 1.0)