From 18fbb7fd6c46411584245b1b30bbb9077bdd16c9 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 16 Feb 2015 20:35:57 +0100 Subject: [PATCH] Fix utf8-non-encoding in xml-escape --- libcitadel/lib/stringbuf.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index baa9c69a7..134ff4779 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -2006,32 +2006,13 @@ void StrBufXMLEscAppend(StrBuf *OutBuf, *pt = *pch; pt++; pch++; } - else if (*pch < 0x20) { - /* we probably shouldn't be doing this */ - if (OverrideLowChars) - { - *pt = '_'; - pt ++; - pch ++; - } - else - { - *pt = '&'; - pt++; - *pt = HexList[*(unsigned char*)pch][0]; - pt ++; - *pt = HexList[*(unsigned char*)pch][1]; - pt ++; pch ++; - *pt = '&'; - pt++; - pch ++; - } - } else { IsUtf8Sequence = Ctdl_GetUtf8SequenceLength(pch, pche); if (IsUtf8Sequence) { - while (IsUtf8Sequence > 0){ + while ((IsUtf8Sequence > 0) && + (pch < pche)) + { *pt = *pch; pt ++; pch ++; -- 2.30.2