summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-08 17:47:01 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-08 17:47:01 +0000
commit462ab60be82e8be85ffa32e2a15883cf7486f0dd (patch)
tree9526c68593c42df0ee37061f1881e2678b02334a
parentc02521c917656a056f7786493d632bf10cce3791 (diff)
downloadrspamd-462ab60be82e8be85ffa32e2a15883cf7486f0dd.tar.gz
rspamd-462ab60be82e8be85ffa32e2a15883cf7486f0dd.zip
[Minor] Oops, fix memory drainage
-rw-r--r--src/libmime/mime_headers.c7
-rw-r--r--test/lua/unit/received.lua6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index 0a79e3441..d0388a632 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -1092,10 +1092,14 @@ rspamd_smtp_received_process_part (struct rspamd_task *task,
&npart->data, &npart->dlen);
}
+ *last = p - (const guchar *)data;
+
return npart;
}
break;
case skip_spaces:
+ *last = p - (const guchar *)data;
+
return npart;
default:
break;
@@ -1141,6 +1145,7 @@ rspamd_smtp_received_spill (struct rspamd_task *task,
return NULL;
}
+ g_assert (pos != 0);
p += pos;
len = end > p ? end - p : 0;
DL_APPEND (head, cur_part);
@@ -1157,6 +1162,7 @@ rspamd_smtp_received_spill (struct rspamd_task *task,
return NULL;
}
+ g_assert (pos != 0);
p += pos;
len = end > p ? end - p : 0;
DL_APPEND (head, cur_part);
@@ -1212,6 +1218,7 @@ rspamd_smtp_received_spill (struct rspamd_task *task,
return NULL;
}
else {
+ g_assert (pos != 0);
p += pos;
len = end > p ? end - p : 0;
DL_APPEND (head, cur_part);
diff --git a/test/lua/unit/received.lua b/test/lua/unit/received.lua
index 19decc397..c633a99b1 100644
--- a/test/lua/unit/received.lua
+++ b/test/lua/unit/received.lua
@@ -25,6 +25,12 @@ context("Received headers parser", function()
]]
local cases = {
+ {[[from smtp11.mailtrack.pl (smtp11.mailtrack.pl [185.243.30.90])]],
+ {
+ real_ip = '185.243.30.90',
+ real_hostname = 'smtp11.mailtrack.pl'
+ },
+ },
{[[from asx121.turbo-inline.com [7.165.23.113] by mx.reskind.net with QMQP; Fri, 08 Feb 2019 06:56:18 -0500]],
{
real_ip = '7.165.23.113',