aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-09-27 20:44:56 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-09-27 20:44:56 +0100
commitd0106139487f80bc4fcc926d7329f3e0aada234d (patch)
tree2464c60d688d15505fb8d45e86a8217eeba0fe00 /src/libmime
parent2d053b6fac9a7028181a31684cd7bada0016bf37 (diff)
downloadrspamd-d0106139487f80bc4fcc926d7329f3e0aada234d.tar.gz
rspamd-d0106139487f80bc4fcc926d7329f3e0aada234d.zip
[Fix] Check for magic when checking for an archive
Issue: #1848 Closes: #1848 MFH: 1.6
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/archives.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 0d24cb28f..8cd45f0b4 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -697,7 +697,19 @@ rspamd_archive_cheat_detect (struct rspamd_mime_part *part, const gchar *str,
&srch) == 0) {
if (rspamd_substring_search_caseless (ct->subtype.begin, ct->subtype.len,
str, strlen (str)) != -1) {
- return TRUE;
+ /* We still need to check magic, see #1848 */
+ if (magic_start != NULL) {
+ if (part->parsed_data.len > magic_len &&
+ memcmp (part->parsed_data.begin,
+ magic_start, magic_len) == 0) {
+ return TRUE;
+ }
+ /* No magic, refuse this type of archive */
+ return FALSE;
+ }
+ else {
+ return TRUE;
+ }
}
}
@@ -709,6 +721,16 @@ rspamd_archive_cheat_detect (struct rspamd_mime_part *part, const gchar *str,
if (rspamd_lc_cmp (p, str, strlen (str)) == 0) {
if (*(p - 1) == '.') {
+ if (magic_start != NULL) {
+ if (part->parsed_data.len > magic_len &&
+ memcmp (part->parsed_data.begin,
+ magic_start, magic_len) == 0) {
+ return TRUE;
+ }
+ /* No magic, refuse this type of archive */
+ return FALSE;
+ }
+
return TRUE;
}
}