]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Check array length before indexing
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 20 Apr 2021 16:23:52 +0000 (17:23 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 20 Apr 2021 16:23:52 +0000 (17:23 +0100)
src/lua/lua_task.c

index 01c4504224c92485fa407dc8477b7ff526013235..e44bc81b302cb06cb59a8d47a54640970d0eba0c 100644 (file)
@@ -4111,7 +4111,7 @@ lua_task_get_reply_sender (lua_State *L)
                        addrs = rspamd_email_address_from_mime (task->task_pool, rh->decoded,
                                        strlen (rh->decoded), NULL, -1);
 
-                       if (addrs == NULL) {
+                       if (addrs == NULL || addrs->len == 0) {
                                lua_pushnil (L);
                        }
                        else {
@@ -4122,7 +4122,7 @@ lua_task_get_reply_sender (lua_State *L)
                        }
                }
                else if (MESSAGE_FIELD_CHECK (task, from_mime) &&
-                               MESSAGE_FIELD (task, from_mime)->len == 1) {
+                               MESSAGE_FIELD (task, from_mime)->len >= 1) {
                        struct rspamd_email_address *addr;
 
                        addr = (struct rspamd_email_address *)g_ptr_array_index (