This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 883d4cae9ade53fbba28cac4d2042bfac11a1659 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Jul 24 18:10:32 2019 +0100 Partial fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=55620 Prevent Tomcat from starting when $CATALINA_HOME and/or $CATALINA_BASE contains a semi-colon on Windows or a colon on Linux/FreeBSD/etc. --- bin/catalina.bat | 17 +++++++++++++++++ bin/catalina.sh | 14 ++++++++++++++ webapps/docs/changelog.xml | 5 +++++ 3 files changed, 36 insertions(+) diff --git a/bin/catalina.bat b/bin/catalina.bat index 740ee03..f92e296 100755 --- a/bin/catalina.bat +++ b/bin/catalina.bat @@ -144,6 +144,23 @@ if not "%CATALINA_BASE%" == "" goto gotBase set "CATALINA_BASE=%CATALINA_HOME%" :gotBase +rem Ensure that neither CATALINA_HOME nor CATALINA_BASE contains a semi-colon +rem as this is used as the separator in the classpath and Java provides no +rem mechanism for escaping if the same character appears in the path. Check this +rem by replacing all occurrences of ';' with '' and checking that neither +rem CATALINA_HOME nor CATALINA_BASE have changed +if "%CATALINA_HOME%" == "%CATALINA_HOME:;=%" goto homeNoSemicolon +echo Using CATALINA_HOME: "%CATALINA_HOME%" +echo Unable to start as CATALINA_HOME contains a semicolon (;) character +goto end +:homeNoSemicolon + +if "%CATALINA_BASE%" == "%CATALINA_BASE:;=%" goto baseNoSemicolon +echo Using CATALINA_BASE: "%CATALINA_BASE%" +echo Unable to start as CATALINA_BASE contains a semicolon (;) character +goto end +:baseNoSemicolon + rem Ensure that any user defined CLASSPATH variables are not used on startup, rem but allow them to be specified in setenv.bat, in rare case when it is needed. set CLASSPATH= diff --git a/bin/catalina.sh b/bin/catalina.sh index 1470fd1..ae85a71 100755 --- a/bin/catalina.sh +++ b/bin/catalina.sh @@ -158,6 +158,20 @@ if $cygwin; then [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi +# Ensure that neither CATALINA_HOME nor CATALINA_BASE contains a colon +# as this is used as the separator in the classpath and Java provides no +# mechanism for escaping if the same character appears in the path. +case $CATALINA_HOME in + *:*) echo "Using CATALINA_HOME: $CATALINA_HOME"; + echo "Unable to start as CATALINA_HOME contains a colon (:) character"; + exit 1; +esac +case $CATALINA_BASE in + *:*) echo "Using CATALINA_BASE: $CATALINA_BASE"; + echo "Unable to start as CATALINA_BASE contains a colon (:) character"; + exit 1; +esac + # For OS400 if $os400; then # Set job priority to standard for interactive (interactive - 6) by using diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c6e7d52..d462edc 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -74,6 +74,11 @@ Limit the default JPDA (remote debugging interface) listen address to <code>localhost:8000</code>. (markt) </add> + <fix> + <bug>55620</bug>: Partial fix. Prevent Tomcat from starting when + <code>$CATALINA_HOME</code> and/or <code>$CATALINA_BASE</code> contains + a semi-colon on Windows or a colon on Linux/FreeBSD/etc. (markt) + </fix> </changelog> </subsection> </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org