]> code.citadel.org Git - citadel.git/commitdiff
mime_parser.c: pad the encoded-to-unencoded buffer
authorArt Cancro <ajc@citadel.org>
Wed, 3 May 2006 03:29:12 +0000 (03:29 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 3 May 2006 03:29:12 +0000 (03:29 +0000)
a bit more, because certain MIME parts (such as tnef) were blowing the target
buffer.  This fixes a problem whose symptom is a server crash during fulltext
indexing.

webcit/mime_parser.c

index 02edd1c5893b93c0fa3a2ba97f3dcc9b6eb4ae51..bf850a288d4edf41a81aa75b10f218cff2d91b02 100644 (file)
@@ -209,12 +209,12 @@ void mime_decode(char *partnum,
                return;
        }
        /**
-        * Allocate a buffer for the decoded data.  The output buffer is the
-        * same size as the input buffer; this assumes that the decoded data
-        * will never be larger than the encoded data.  This is a safe
-        * assumption with base64, uuencode, and quoted-printable.
+        * Allocate a buffer for the decoded data.  The output buffer is slightly
+        * larger than the input buffer; this assumes that the decoded data
+        * will never be significantly larger than the encoded data.  This is a
+        * safe assumption with base64, uuencode, and quoted-printable.
         */
-       decoded = malloc(length+2048);
+       decoded = malloc(length + 32768);
        if (decoded == NULL) {
                return;
        }