From: Vsevolod Stakhov Date: Fri, 8 Feb 2019 17:47:01 +0000 (+0000) Subject: [Minor] Oops, fix memory drainage X-Git-Tag: 1.9.0~185 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=462ab60be82e8be85ffa32e2a15883cf7486f0dd;p=thirdparty%2Frspamd.git [Minor] Oops, fix memory drainage --- diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index 0a79e34412..d0388a6323 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 19decc3972..c633a99b1e 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',