[gmime-devel] Issue with header decoding (continues)
- From: evil legacy <evil legacy gmail com>
- To: gmime-devel-list gnome org
- Subject: [gmime-devel] Issue with header decoding (continues)
- Date: Wed, 14 Dec 2011 20:26:01 +0200
Hi,
After more debugging, I found that the problem is when iconv (cd, NULL, NULL, &outbuf, &outleft) tries to flush the buffer to outbuf, but outbuf isn't big enough to hold it.
This little patch to the charset_convert function seems to fix this problem (works for me):
<patch>
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index ca32b61..093deee 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -1553,7 +1553,15 @@ charset_convert (iconv_t cd, const char *inbuf, size_t inleft, char **outp, size
}
} while (inleft > 0);
- iconv (cd, NULL, NULL, &outbuf, &outleft);
+ while (iconv (cd, NULL, NULL, &outbuf, &outleft) == (size_t) -1)
+ if (errno == E2BIG) {
+ outlen += 16;
+ rc = (size_t) (outbuf - out);
+ out = g_realloc (out, outlen + 1);
+ outleft = outlen - rc;
+ outbuf = out + rc;
+ }
+
*outbuf++ = '\0';
*outlenp = outlen;
</patch>
Best Regards
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]