aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_headers.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-01 15:03:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-01 15:03:10 +0100
commitc1f9bfc86391e4be50a5fbd16a7b899288a3a84c (patch)
treeeb61246b0eccd1aff0fc083a15cda752d058d1ec /src/libmime/mime_headers.c
parent6ea2346e8f2baeeadd9dd5e61610281f2838ca07 (diff)
downloadrspamd-c1f9bfc86391e4be50a5fbd16a7b899288a3a84c.tar.gz
rspamd-c1f9bfc86391e4be50a5fbd16a7b899288a3a84c.zip
[Fix] Fix parsing of the received headers with empty part
Diffstat (limited to 'src/libmime/mime_headers.c')
-rw-r--r--src/libmime/mime_headers.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index e83debc43..f7eb86f2e 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -1098,8 +1098,14 @@ rspamd_smtp_received_process_part (struct rspamd_task *task,
p ++;
break;
case all_done:
- *last = p - (const guchar *)data;
- return npart;
+ if (p > (const guchar *)data) {
+ *last = p - (const guchar *) data;
+ return npart;
+ }
+ else {
+ /* Empty element */
+ return NULL;
+ }
break;
}
}
@@ -1120,9 +1126,11 @@ rspamd_smtp_received_process_part (struct rspamd_task *task,
}
break;
case skip_spaces:
- *last = p - (const guchar *)data;
+ if (p > c) {
+ *last = p - (const guchar *) data;
- return npart;
+ return npart;
+ }
default:
break;
}