From: Dominik Csapak <d.csapak@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>, pmg-devel@lists.proxmox.com
Subject: Re: [PATCH log-tracker] handle smtp filter message: prevent panicking with non-standard output
Date: Wed, 10 Jun 2026 16:00:42 +0200 [thread overview]
Message-ID: <b20e675c-1c94-4c72-9962-fd28d99c4f18@proxmox.com> (raw)
In-Reply-To: <8ecd0b57-478d-4d99-ab92-19bcc4b00a3f@proxmox.com>
On 6/10/26 3:51 PM, Thomas Lamprecht wrote:
> On 10/06/2026 15:15, Dominik Csapak wrote:
>> Currently a custom checkscript can print it's output into the syslog
>> under the guise of the pmg-smtp-filter unit, so it will picked up
>> by the log tracker. In case there is a line with a delimiter and nothing
>> after it, every thing before is detected as a qid but the remaining
>> message only contains the delimiter.
>>
>> Prevent the panicking here by checking its length beforehand.
>>
>> While the real fix is either to prevent custom check scripts to output
>> to syslog, or to prefix it with something we can filter away here,
>> protecting against malformed output still makes sense.
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>> src/main.rs | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/src/main.rs b/src/main.rs
>> index efdfd30..4787a36 100644
>> --- a/src/main.rs
>> +++ b/src/main.rs
>> @@ -115,6 +115,11 @@ fn handle_pmg_smtp_filter_message(msg: &[u8], parser: &mut Parser, complete_line
>> Some((q, m)) => (q, m),
>> None => return,
>> };
>> + if data.len() < 2 {
>> + // after the QID there is no separator and space, so it can't be a proper smtp-filter
>> + // message. It's possibly output from a custom check script or a malformed log line.
>
> this comment confuses me, reads like a separator and space after a QID
> being wrong, but it's what's expected, with the &data[2..]; IMO no comment
> would be required, but short one can be fine - will squash that in on applying.
ah ok sorry, i wanted to express that this is missing in this branch,
so after the length check shows it's shorter
>
>> + return;
>> + }
>> // skip ': ' following the QID
>> let data = &data[2..];
>>
>
next prev parent reply other threads:[~2026-06-10 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 13:15 [PATCH log-tracker] handle smtp filter message: prevent panicking with non-standard output Dominik Csapak
2026-06-10 13:51 ` Thomas Lamprecht
2026-06-10 14:00 ` Dominik Csapak [this message]
2026-06-10 14:56 ` applied: " 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=b20e675c-1c94-4c72-9962-fd28d99c4f18@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
--cc=t.lamprecht@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.