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

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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new b67ac5d5af Correctly split literal "]]>" if it appears in CDATA
b67ac5d5af is described below

commit b67ac5d5afc0cb771b124c36de62d0de75091188
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jul 20 11:05:46 2026 +0100

    Correctly split literal "]]>" if it appears in CDATA
---
 java/org/apache/catalina/util/XMLWriter.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/util/XMLWriter.java 
b/java/org/apache/catalina/util/XMLWriter.java
index c14c9c2ad4..978cc0cf0d 100644
--- a/java/org/apache/catalina/util/XMLWriter.java
+++ b/java/org/apache/catalina/util/XMLWriter.java
@@ -247,8 +247,8 @@ public class XMLWriter {
         int idx;
         while ((idx = data.indexOf("]]>", start)) >= 0) {
             buffer.append(data, start, idx);
-            // We terminate, then append the ]]>, and restart the sequence
-            buffer.append("]]>]]><![CDATA[");
+            // Embedded ']]>'. We append ']]', terminate, restart the 
sequence, append '>' and then continue.
+            buffer.append("]]]]><![CDATA[>");
             start = idx + 3;
         }
         buffer.append(data.substring(start));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to