diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 17:23:52 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-04-20 17:23:52 +0100 |
commit | a0c8f40933a55ac8d1cd4c95d7b3f2abbc8974c0 (patch) | |
tree | fa193b1c75b0cfef8c08cf2aea83b2d1a8c9e768 /src/lua | |
parent | 60d075965347f1be5ec35fc72f8d3187151d0e1b (diff) | |
download | rspamd-a0c8f40933a55ac8d1cd4c95d7b3f2abbc8974c0.tar.gz rspamd-a0c8f40933a55ac8d1cd4c95d7b3f2abbc8974c0.zip |
[Minor] Check array length before indexing
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 01c450422..e44bc81b3 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -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 ( |