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

markt-asf 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 1c18d40b6b Correctly split literal "]]>" if it appears in CDATA
1c18d40b6b is described below

commit 1c18d40b6b01c48a2813ae8a45e1b671d9bdbc8d
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