From 1ff457a7db61d1e3584edcd026abe0579ceacb91 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 26 Feb 2021 21:35:45 -0600 Subject: [PATCH] Handle non-RFC-conforming end-of-message markers RFC3164 states in 4.1.3 "MSG Part of a syslog Packet": The MSG part will fill the remainder of the syslog packet. ... There is no ending delimiter to this part. Some implementations do not follow this. --- testsuite/lib/exec/minlogd.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/lib/exec/minlogd.pl b/testsuite/lib/exec/minlogd.pl index 0b5d0c0..88b1483 100755 --- a/testsuite/lib/exec/minlogd.pl +++ b/testsuite/lib/exec/minlogd.pl @@ -164,6 +164,11 @@ sub handle_message ($) { } else { die "unrecognized syslog message format (newer version?):\n $_" } + # Some messages may have a trailing newline, while others do not. The + # syslog RFCs state that end-of-message is end-of-datagram and any octet + # is allowed in the message, but Sys::Syslog seems to append a NUL. + $MSG =~ s/[\s\r\n\0]+$//; # remove trailing whitespace, newline, and nulls + print LoggerOutput $PRI, join(' ', 1, $TIMESTAMP, $HOSTNAME, $APPNAME, $PROCID, $MSGID, $SDAT, $MSG),"\n"; -- 2.25.1