lib: fix xml_escape(), again

Commit ff0b8d0898 (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
This commit is contained in:
Juha Sointusalo 2018-11-11 01:18:56 +02:00
parent e72c05ace2
commit 5e23a9482c
1 changed files with 3 additions and 1 deletions

View File

@ -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;