]> code.citadel.org Git - citadel.git/blobdiff - libcitadel/lib/stringbuf.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / libcitadel / lib / stringbuf.c
index baa9c69a79ea8a5df0e58e8e2096a93a567f8f0f..0340ce4d44fb51e6edd50578e5d31c3a90eef890 100644 (file)
@@ -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 ++;
@@ -2846,7 +2827,7 @@ int StrBufDecodeBase64To(const StrBuf *BufIn, StrBuf *BufOut)
                return -1;
 
        if (BufOut->BufSize < BufIn->BufUsed)
-               IncreaseBuf(BufOut, BufIn->BufUsed, 0);
+               IncreaseBuf(BufOut, 0, BufIn->BufUsed);
 
        BufOut->BufUsed = CtdlDecodeBase64(BufOut->buf,
                                           BufIn->buf,