Ensure that upload handler syslog messages do not span lines
authorJacob Bachmeyer <jcb@gnu.org>
Fri, 10 Dec 2021 22:54:51 +0000 (16:54 -0600)
committerJacob Bachmeyer <jcb@gnu.org>
Fri, 10 Dec 2021 22:54:51 +0000 (16:54 -0600)
upload-ftp-v1.2.pl

index b59b71f0e44ed1fb22286b26677f9edb2780d554..b423ce1316733105f7e9a340966be949fe0df02e 100755 (executable)
@@ -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.