* shorten len if we shorten the buf
authorWilfried Göesgens <willi@citadel.org>
Tue, 16 Jun 2009 20:08:07 +0000 (20:08 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 16 Jun 2009 20:08:07 +0000 (20:08 +0000)
libcitadel/lib/stringbuf.c

index dcf6b9121304f1670042a3e7d59057f7fb02279e..1af664ef1af1b4f7040d1449a175b8b01d286f81 100644 (file)
@@ -2632,10 +2632,11 @@ void StrBuf_RFC822_to_Utf8(StrBuf *Target, const StrBuf *DecodeMe, const StrBuf*
                        /* did we find a gab just filled with blanks? */
                        if (ptr == next)
                        {
+                               long gap = next - start;
                                memmove (end + 2,
                                         next,
-                                        len - (next - start));
-                               
+                                        len - (gap));
+                               len -= gap;
                                /* now terminate the gab at the end */
                                delta = (next - end) - 2; ////TODO: const! 
                                ((StrBuf*)DecodeMe)->BufUsed -= delta;