summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-09-27 20:44:56 +0100
committerAndrew Lewis <nerf@judo.za.org>2017-10-18 00:26:15 +0200
commitadd7587e2ac6826ef7714c006192be94bcde657c (patch)
tree0466c9faed0871e9a772ccbba34a7ae02b12cee5 /src
parentf71ebdb41018239c28202870e5ad9bf45af5479f (diff)
downloadrspamd-add7587e2ac6826ef7714c006192be94bcde657c.tar.gz
rspamd-add7587e2ac6826ef7714c006192be94bcde657c.zip
[Fix] Check for magic when checking for an archive
Issue: #1848 Closes: #1848 MFH: 1.6
Diffstat (limited to 'src')
-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 2123e1131..7d4f1c1c6 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -573,7 +573,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;
+ }
}
}
@@ -585,6 +597,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;
}
}