From 794b0a07483fdae7125f325d34fbea6b40a67885 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Tue, 3 Sep 2024 01:33:29 +0000 Subject: encoding/xml: allow ]]> in attribute values This is permitted by the XML specification. Fixes #68387 Change-Id: Ic4ab5520a08a5a997f1c3d13c6d5f80c0521e45c GitHub-Last-Rev: 6d2ac307bbd0ba7d50830ad8b879c00cc3a7242b GitHub-Pull-Request: golang/go#69197 Reviewed-on: https://go-review.googlesource.com/c/go/+/610056 Auto-Submit: Ian Lance Taylor Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- src/encoding/xml/xml.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/encoding/xml/xml.go') diff --git a/src/encoding/xml/xml.go b/src/encoding/xml/xml.go index 0fe323f7c8..951676d403 100644 --- a/src/encoding/xml/xml.go +++ b/src/encoding/xml/xml.go @@ -1004,8 +1004,9 @@ Input: } // . - // It is an error for ]]> to appear in ordinary text. - if b0 == ']' && b1 == ']' && b == '>' { + // It is an error for ]]> to appear in ordinary text, + // but it is allowed in quoted strings. + if quote < 0 && b0 == ']' && b1 == ']' && b == '>' { if cdata { trunc = 2 break Input -- cgit v1.3-5-g9baa