aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_parser.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-18 12:56:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-09-18 12:56:46 +0100
commit907cc2eb616124abe41e7c1b525139a54f3cea8f (patch)
tree1b8327db28fb620acf1dbbedf46c7bac71fbad98 /src/libmime/mime_parser.c
parent4041c2d64024f27488461e03fcd587dfbb34c4b0 (diff)
downloadrspamd-907cc2eb616124abe41e7c1b525139a54f3cea8f.tar.gz
rspamd-907cc2eb616124abe41e7c1b525139a54f3cea8f.zip
[Minor] Fix more issues in libmime
Found by: coverity scan
Diffstat (limited to 'src/libmime/mime_parser.c')
-rw-r--r--src/libmime/mime_parser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libmime/mime_parser.c b/src/libmime/mime_parser.c
index 0363d4514..6ec28e057 100644
--- a/src/libmime/mime_parser.c
+++ b/src/libmime/mime_parser.c
@@ -596,14 +596,14 @@ rspamd_mime_parse_normal_part (struct rspamd_task *task,
g_assert (part != NULL);
rspamd_mime_part_get_cte (task, part->raw_headers, part,
- !(part->ct->flags & RSPAMD_CONTENT_TYPE_MESSAGE));
+ part->ct && !(part->ct->flags & RSPAMD_CONTENT_TYPE_MESSAGE));
rspamd_mime_part_get_cd (task, part);
switch (part->cte) {
case RSPAMD_CTE_7BIT:
case RSPAMD_CTE_8BIT:
case RSPAMD_CTE_UNKNOWN:
- if (part->ct->flags & RSPAMD_CONTENT_TYPE_MISSING) {
+ if (part->ct && (part->ct->flags & RSPAMD_CONTENT_TYPE_MISSING)) {
if (part->cte != RSPAMD_CTE_7BIT) {
/* We have something that has a missing content-type,
* but it has non-7bit characters.
@@ -658,7 +658,9 @@ rspamd_mime_parse_normal_part (struct rspamd_task *task,
}
else {
msg_err_task ("invalid quoted-printable encoded part, assume 8bit");
- part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ if (part->ct) {
+ part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ }
part->cte = RSPAMD_CTE_8BIT;
memcpy (parsed->str, part->raw_data.begin, part->raw_data.len);
parsed->len = part->raw_data.len;
@@ -694,7 +696,9 @@ rspamd_mime_parse_normal_part (struct rspamd_task *task,
}
else {
msg_err_task ("invalid uuencoding in encoded part, assume 8bit");
- part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ if (part->ct) {
+ part->ct->flags |= RSPAMD_CONTENT_TYPE_BROKEN;
+ }
part->cte = RSPAMD_CTE_8BIT;
parsed->len = MIN (part->raw_data.len, parsed->allocated);
memcpy (parsed->str, part->raw_data.begin, parsed->len);