commit 836d0d3: [Fix] Fix adding of the empty archive file for gzip
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Jul 13 14:49:06 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-07-13 15:40:43 +0100
URL: https://github.com/rspamd/rspamd/commit/836d0d30700b85a1411394c66208408868488dcf
[Fix] Fix adding of the empty archive file for gzip
---
src/libmime/archives.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 32a251c94..12fa15276 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -68,11 +68,11 @@ rspamd_archive_file_try_utf (struct rspamd_task *task,
UConverter *utf8_converter;
conv = rspamd_mime_get_converter_cached (charset, task->task_pool,
- FALSE, &uc_err);
+ TRUE, &uc_err);
utf8_converter = rspamd_get_utf8_converter ();
if (conv == NULL) {
- msg_err_task ("cannot open converter for %s: %s",
+ msg_info_task ("cannot open converter for %s: %s",
charset, u_errorName (uc_err));
return NULL;
@@ -82,7 +82,7 @@ rspamd_archive_file_try_utf (struct rspamd_task *task,
r = rspamd_converter_to_uchars (conv, tmp, inlen + 1,
in, inlen, &uc_err);
if (!U_SUCCESS (uc_err)) {
- msg_err_task ("cannot convert data to unicode from %s: %s",
+ msg_info_task ("cannot convert data to unicode from %s: %s",
charset, u_errorName (uc_err));
g_free (tmp);
@@ -95,7 +95,7 @@ rspamd_archive_file_try_utf (struct rspamd_task *task,
r = ucnv_fromUChars (utf8_converter, res->str, dlen, tmp, r, &uc_err);
if (!U_SUCCESS (uc_err)) {
- msg_err_task ("cannot convert data from unicode from %s: %s",
+ msg_info_task ("cannot convert data from unicode from %s: %s",
charset, u_errorName (uc_err));
g_free (tmp);
g_string_free (res, TRUE);
@@ -1750,7 +1750,13 @@ rspamd_archive_process_gzip (struct rspamd_task *task,
f->fname = rspamd_archive_file_try_utf (task, fname_start,
p - fname_start);
- g_ptr_array_add (arch->files, f);
+ if (f->fname) {
+ g_ptr_array_add (arch->files, f);
+ }
+ else {
+ /* Invalid filename, skip */
+ g_free (f);
+ }
goto set;
}
More information about the Commits
mailing list