commit f042f98: [Minor] Save zero terminated string properly

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jul 27 15:28:09 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-07-27 16:24:39 +0100
URL: https://github.com/rspamd/rspamd/commit/f042f98099e3f53dcabf30f03507a71de6f07bdf

[Minor] Save zero terminated string properly

---
 src/libmime/mime_headers.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index de4184bb9..c711b5bba 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -1625,8 +1625,11 @@ rspamd_smtp_received_parse (struct rspamd_task *task,
 		case RSPAMD_RECEIVED_PART_FOR:
 			rh->for_addr = rspamd_email_address_from_smtp (cur->data, cur->dlen);
 
-			if (rh->for_addr) {
-				rh->for_mbox = rh->for_addr->addr;
+			if (rh->for_addr && rh->for_addr->addr_len > 0) {
+				t1.begin = rh->for_addr->addr;
+				t1.len = rh->for_addr->addr_len;
+				rh->for_mbox = rspamd_mempool_ftokdup (task->task_pool,
+						&t1);
 
 				rspamd_mempool_add_destructor (task->task_pool,
 						(rspamd_mempool_destruct_t)rspamd_email_address_free,


More information about the Commits mailing list