commit 4219a66: [Minor] Fix task from string creation

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Sep 9 12:14:08 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-09 12:00:06 +0100
URL: https://github.com/rspamd/rspamd/commit/4219a66db3f633d102dfe38e5315f0f552b85262

[Minor] Fix task from string creation

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

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 576c7e1cc..cd33ac2e0 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1669,8 +1669,9 @@ lua_task_load_from_string (lua_State * L)
 		}
 
 		task = rspamd_task_new (NULL, cfg, NULL, NULL, NULL);
-		task->msg.begin = g_strdup (str_message);
-		task->msg.len   = message_len;
+		task->msg.begin = g_malloc (message_len);
+		memcpy ((gchar *)task->msg.begin, str_message, message_len);
+		task->msg.len  = message_len;
 		rspamd_mempool_add_destructor (task->task_pool, lua_task_free_dtor,
 				(gpointer)task->msg.begin);
 	}


More information about the Commits mailing list