aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_parser.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-13 14:47:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-13 14:47:25 +0100
commit6dcd2bd6760bdf33c953d89e5c6752a3154bd4ab (patch)
tree3f4d672d80725614863b0550110ca79c5c03241d /src/libmime/mime_parser.c
parentc3ca41d039721004af10cf77083ccebb4b3a0bb8 (diff)
downloadrspamd-6dcd2bd6760bdf33c953d89e5c6752a3154bd4ab.tar.gz
rspamd-6dcd2bd6760bdf33c953d89e5c6752a3154bd4ab.zip
[Fix] Fix more issues with nested messages + tests
Diffstat (limited to 'src/libmime/mime_parser.c')
-rw-r--r--src/libmime/mime_parser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index b40353dca..db945f2ed 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -1297,15 +1297,16 @@ rspamd_mime_parse_message (struct rspamd_task *task,
ret = rspamd_mime_parse_multipart_part (task, npart, nst, err);
}
else if (sel->flags & RSPAMD_CONTENT_TYPE_MESSAGE) {
- g_ptr_array_add (nst->stack, npart);
- nst->nesting ++;
- ret = rspamd_mime_parse_message (task, npart, nst, err);
+ if ((ret = rspamd_mime_parse_normal_part (task, npart, nst, err))
+ == RSPAMD_MIME_PARSE_OK) {
+ ret = rspamd_mime_parse_message (task, npart, nst, err);
+ }
}
else {
ret = rspamd_mime_parse_normal_part (task, npart, nst, err);
}
- if (part) {
+ if (part && st->stack->len > 0) {
/* Remove message part from the parent stack */
g_ptr_array_remove_index_fast (st->stack, st->stack->len - 1);
st->nesting --;