commit 449b77c: [Minor] Fix task:set_recipients when the original recipients are absent

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Nov 28 12:28:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-28 12:16:53 +0000
URL: https://github.com/rspamd/rspamd/commit/449b77cc82eacd9928f1fee7f4559eeb048c284b

[Minor] Fix task:set_recipients when the original recipients are absent

---
 src/lua/lua_task.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 48006fa84..d3e08dee4 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -3703,7 +3703,13 @@ lua_task_set_recipients (lua_State *L)
 		switch (what) {
 		case RSPAMD_ADDRESS_SMTP:
 			/* Here we check merely envelope rcpt */
-			ptrs = task->rcpt_envelope;
+			if (task->rcpt_envelope) {
+				ptrs = task->rcpt_envelope;
+			}
+			else {
+				ptrs = g_ptr_array_new ();
+				task->rcpt_envelope = ptrs;
+			}
 			break;
 		case RSPAMD_ADDRESS_MIME:
 			/* Here we check merely mime rcpt */
@@ -3713,7 +3719,13 @@ lua_task_set_recipients (lua_State *L)
 		case RSPAMD_ADDRESS_ANY:
 		default:
 			if (task->rcpt_envelope) {
-				ptrs = task->rcpt_envelope;
+				if (task->rcpt_envelope) {
+					ptrs = task->rcpt_envelope;
+				}
+				else {
+					ptrs = g_ptr_array_new ();
+					task->rcpt_envelope = ptrs;
+				}
 			}
 			else {
 				ptrs = MESSAGE_FIELD_CHECK (task, rcpt_mime);


More information about the Commits mailing list