From 5e23a9482c82303399ee8c2fb08d5072ba7c2df6 Mon Sep 17 00:00:00 2001 From: Juha Sointusalo Date: Sun, 11 Nov 2018 01:18:56 +0200 Subject: [PATCH] lib: fix xml_escape(), again Commit ff0b8d08985707f089f934816b0d28841b709c80 (fix CDATA escaping) introduced two bugs to xml_escape(): - it eats ']' characters that are not part of ']]>' - it eats the next character after ']]>' Fixes #2809 --- lib/parse.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/parse.cpp b/lib/parse.cpp index ae463e19cd..6146d26ab7 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -376,7 +376,9 @@ void xml_escape(const char* in, char* out, int len) { if (!strncmp(in, "]]>", 3)) { strcpy(p, "]]>"); p += 6; - in += 3; + in += 2; // +1 from for loop + } else { + *p++ = x; } } else { *p++ = x;