diff --git a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php index bfd0f2abb0b40186e289280c3b9f58814787e62b..e5c0cefa52af32c3bf5e33dc89d509092ca9b177 100644 --- a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php @@ -45,7 +45,8 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface */ public function __construct(Configuration $config) { - $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp'); + // Remove any non-printable characters before storing + $this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp')); } diff --git a/lib/SimpleSAML/Logger/FileLoggingHandler.php b/lib/SimpleSAML/Logger/FileLoggingHandler.php index 641a5f23535aa239cbcda1aeb813884f5b299e56..ca2c87bcdfaa9543b3c5545ee63ad7d754d75cf0 100644 --- a/lib/SimpleSAML/Logger/FileLoggingHandler.php +++ b/lib/SimpleSAML/Logger/FileLoggingHandler.php @@ -55,7 +55,9 @@ class FileLoggingHandler implements LoggingHandlerInterface // get the metadata handler option from the configuration $this->logFile = $config->getPathValue('loggingdir', 'log/') . $config->getString('logging.logfile', 'simplesamlphp.log'); - $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp'); + + // Remove any non-printable characters before storing + $this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp')); if (@file_exists($this->logFile)) { if (!@is_writeable($this->logFile)) { diff --git a/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php b/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php index c6860a2a22d51f7ca0539c21633b7c02fe4e82cc..e2a8f93a06df1dccc2f7514ab38ec79ff5c44075 100644 --- a/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php +++ b/lib/SimpleSAML/Logger/StandardErrorLoggingHandler.php @@ -22,7 +22,8 @@ class StandardErrorLoggingHandler extends FileLoggingHandler */ public function __construct(Configuration $config) { - $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp'); + // Remove any non-printable characters before storing + $this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp')); $this->logFile = 'php://stderr'; } } diff --git a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php index 14309cac0d7996468deefa37bc131c0a3abf3181..7cf2fc6d05b022bc39547069e7a1888cdae4edad 100644 --- a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php @@ -29,7 +29,8 @@ class SyslogLoggingHandler implements LoggingHandlerInterface { $facility = $config->getInteger('logging.facility', defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER); - $processname = $config->getString('logging.processname', 'SimpleSAMLphp'); + // Remove any non-printable characters before storing + $processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp')); // Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems if (Utils\System::getOS() === Utils\System::WINDOWS) {