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

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


The following commit(s) were added to refs/heads/main by this push:
     new 37b86df3c1 Avoid deprecated method.
37b86df3c1 is described below

commit 37b86df3c1db83cf7a9f773531fd80bd6e054e49
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu May 11 20:55:36 2023 +0100

    Avoid deprecated method.
---
 java/org/apache/catalina/ssi/SSIExec.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/ssi/SSIExec.java 
b/java/org/apache/catalina/ssi/SSIExec.java
index 605f7fa6db..e85c849106 100644
--- a/java/org/apache/catalina/ssi/SSIExec.java
+++ b/java/org/apache/catalina/ssi/SSIExec.java
@@ -16,11 +16,11 @@
  */
 package org.apache.catalina.ssi;
 
-
 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;
@@ -58,7 +58,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;
                 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