commit f533598: [Minor] Require either by or from parts in received headers
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Oct 8 12:21:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-10-08 13:18:37 +0100
URL: https://github.com/rspamd/rspamd/commit/f5335980825197a5711d51e3545b69f246de6c28 (HEAD -> master)
[Minor] Require either by or from parts in received headers
---
src/libmime/received.cxx | 8 ++++++++
1 file changed, 8 insertions(+)
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) {
More information about the Commits
mailing list