From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [PATCH pmg-api v2 2/2] pmg-smtp-filter: log-headers: trim trailing whitespace
Date: Thu, 11 Jun 2026 12:15:07 +0200 [thread overview]
Message-ID: <20260611101513.1150807-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20260611101513.1150807-1-s.ivanov@proxmox.com>
Reported-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/bin/pmg-smtp-filter | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 7f9cdb85..a746a074 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -714,7 +714,9 @@ sub handle_smtp {
$value = PMG::Utils::decode_rfc1522($value);
# remove non-printable and Unicode format chars to avoid log injection and spoofing
$value =~ s/[^\p{XPosixPrint}]|\p{Cf}/ /g;
- return encode('UTF-8', substr($value, 0, 512));
+ $value = substr($value, 0, 512);
+ $value =~ s/^\s+|\s+$//g;;
+ return encode('UTF-8', $value);
};
# separate line on purpose, so the log-tracker does not parse it as an event
$self->log(
--
2.47.3
next prev parent reply other threads:[~2026-06-11 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 10:15 [PATCH pmg-api v2 0/2] small improvements for log-header functionality Stoiko Ivanov
2026-06-11 10:15 ` [PATCH pmg-api v2 1/2] config: add log-headers to pmg-smtp-filter parameters Stoiko Ivanov
2026-06-11 10:15 ` Stoiko Ivanov [this message]
2026-06-11 11:12 ` applied: [PATCH pmg-api v2 0/2] small improvements for log-header functionality Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611101513.1150807-3-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.