From a648820abb95875779a02363e4671a8ffb51dfa4 Mon Sep 17 00:00:00 2001
From: Jesse Norell <jesse@kci.net>
Date: Fri, 16 Oct 2020 16:59:47 -0600
Subject: [PATCH] leading/trailing whitespace tries to add empty jailkit
 section/program

---
 server/lib/classes/system.inc.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 8bfcf54bec..697c925d18 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -2369,6 +2369,9 @@ class system{
 		# /etc/jailkit/jk_init.ini is the default path, probably not needed?
 		$program_args .= ' -c /etc/jailkit/jk_init.ini -j ?';
 		foreach($app_sections as $app_section) {
+			if ($app_section == '') {
+				continue;
+			}
 			# should check that section exists with jk_init --list ?
 			$program_args .= ' ' . escapeshellarg($app_section);
 		}
@@ -2448,6 +2451,9 @@ class system{
 
 		$bad_paths = array();
 		foreach($programs as $prog) {
+			if ($prog == '') {
+				continue;
+			}
 			foreach ($blacklisted_paths_regex as $re) {
 				if (preg_match($re, $prog, $matches)) {
 					$bad_paths[] = $matches[0];
-- 
GitLab