diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-13 15:40:43 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-13 15:40:43 +0100 |
commit | 836d0d30700b85a1411394c66208408868488dcf (patch) | |
tree | 1c096840242b5a4a30d24d17203271bdaf9af810 | |
parent | efd377128a2944900550cb08810878202e6808c5 (diff) | |
download | rspamd-836d0d30700b85a1411394c66208408868488dcf.tar.gz rspamd-836d0d30700b85a1411394c66208408868488dcf.zip |
[Fix] Fix adding of the empty archive file for gzip
-rw-r--r-- | src/libmime/archives.c | 16 |
1 files 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; } |