commit a0c8f40: [Minor] Check array length before indexing
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Apr 20 16:28:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-04-20 17:23:52 +0100
URL: https://github.com/rspamd/rspamd/commit/a0c8f40933a55ac8d1cd4c95d7b3f2abbc8974c0 (HEAD -> master)
[Minor] Check array length before indexing
---
src/lua/lua_task.c | 4 ++--
1 file 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 (
More information about the Commits
mailing list