From e5da5b01b58189d7b357fd6ae7f93c1c177838f6 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Fri, 10 Dec 2021 16:54:51 -0600 Subject: [PATCH] Ensure that upload handler syslog messages do not span lines --- upload-ftp-v1.2.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/upload-ftp-v1.2.pl b/upload-ftp-v1.2.pl index b59b71f..b423ce1 100755 --- a/upload-ftp-v1.2.pl +++ b/upload-ftp-v1.2.pl @@ -1452,6 +1452,12 @@ sub ftp_die($$) { sub ftp_syslog { my ($priority,$message) = @_; + + # Remove a trailing newline + $message =~ s/[\r\n]+$//; + # Collapse the message to a single line for syslog + $message =~ s/[\r\n]+/ \/ /g; + # The syslog function is pretty picky, and (sometimes) dies silently # when using non-valid syslog priorities. # That's why we run it inside an eval, and print out any errors to STDERR. -- 2.25.1