diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-07 10:37:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-07 10:37:32 +0100 |
commit | c1ae8529075e7b9d6b22daca27b9017839fdd755 (patch) | |
tree | 5caab4f678c1427c159b9660b002ef23e38d5ab1 | |
parent | e6dc2391ad809c7b7ff0d154c35272602314bf8b (diff) | |
download | rspamd-c1ae8529075e7b9d6b22daca27b9017839fdd755.tar.gz rspamd-c1ae8529075e7b9d6b22daca27b9017839fdd755.zip |
[Minor] Do not try to modify constant memory
-rw-r--r-- | src/libmime/mime_headers.c | 3 | ||||
-rw-r--r-- | test/rspamd_cxx_unit_utils.hxx | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index 71b4f2688..c1d5f397c 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -403,7 +403,8 @@ rspamd_mime_headers_process (struct rspamd_task *task, } if (nh->decoded == NULL) { - nh->decoded = ""; + /* As we strip comments in place... */ + nh->decoded = rspamd_mempool_strdup (task->task_pool, ""); } /* We also validate utf8 and replace all non-valid utf8 chars */ diff --git a/test/rspamd_cxx_unit_utils.hxx b/test/rspamd_cxx_unit_utils.hxx index 0cd229a4f..00b5e1b61 100644 --- a/test/rspamd_cxx_unit_utils.hxx +++ b/test/rspamd_cxx_unit_utils.hxx @@ -39,6 +39,7 @@ TEST_CASE("rspamd_strip_smtp_comments_inplace") { {"ab(olo\\)lo)c(foo)", "abc"}, {"ab(trol\\\1lo)c(foo)", "abc"}, {"\\ab(trol\\\1lo)c(foo)", "abc"}, + {"", ""}, }; for (const auto &c : cases) { |