aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-08 13:18:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-08 13:18:37 +0100
commitf5335980825197a5711d51e3545b69f246de6c28 (patch)
tree72dcd7583f6fa525dc3cddcd247868cc3b2e7d56 /src/libmime
parent8a4c1dc178012f04fe1590e74c134af2492ba180 (diff)
downloadrspamd-f5335980825197a5711d51e3545b69f246de6c28.tar.gz
rspamd-f5335980825197a5711d51e3545b69f246de6c28.zip
[Minor] Require either by or from parts in received headers
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/received.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libmime/received.cxx b/src/libmime/received.cxx
index 0ff52da5a..6ba2cd678 100644
--- a/src/libmime/received.cxx
+++ b/src/libmime/received.cxx
@@ -253,6 +253,7 @@ received_spill(const std::string_view &in,
{
std::vector<received_part> parts;
std::ptrdiff_t pos = 0;
+ auto seen_from = false, seen_by = false;
const auto *p = in.data();
const auto *end = p + in.size();
@@ -289,6 +290,7 @@ received_spill(const std::string_view &in,
g_assert (pos != 0);
p += pos;
len = end > p ? end - p : 0;
+ seen_from = true;
}
if (len > 2 && lit_compare_lowercase<2>("by", p)) {
@@ -301,6 +303,12 @@ received_spill(const std::string_view &in,
g_assert (pos != 0);
p += pos;
len = end > p ? end - p : 0;
+ seen_by = true;
+ }
+
+ if (!seen_from && !seen_by) {
+ /* Useless received */
+ return {};
}
while (p < end) {