This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9e4319821298edc17803c3b6023bd53567c4c66c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri May 3 09:35:19 2024 +0100

    Align with 10.1.x.
---
 java/org/apache/catalina/ssi/SSIExec.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/ssi/SSIExec.java 
b/java/org/apache/catalina/ssi/SSIExec.java
index 2def731ea2..07a2499623 100644
--- a/java/org/apache/catalina/ssi/SSIExec.java
+++ b/java/org/apache/catalina/ssi/SSIExec.java
@@ -20,6 +20,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
+import java.util.StringTokenizer;
 
 import org.apache.catalina.util.IOTools;
 import org.apache.tomcat.util.res.StringManager;
@@ -54,7 +55,12 @@ public class SSIExec implements SSICommand {
             boolean foundProgram = false;
             try {
                 Runtime rt = Runtime.getRuntime();
-                Process proc = rt.exec(substitutedValue);
+                StringTokenizer st = new StringTokenizer(substitutedValue);
+                String[] cmdArray = new String[st.countTokens()];
+                for (int i = 0; i < cmdArray.length; i++) {
+                    cmdArray[i] = st.nextToken();
+                }
+                Process proc = rt.exec(cmdArray);
                 foundProgram = true;
                 char[] buf = new char[BUFFER_SIZE];
                 try (BufferedReader stdOutReader = new BufferedReader(new 
InputStreamReader(proc.getInputStream()));


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to