summaryrefslogtreecommitdiff
path: root/mailbox/rfc2047.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-04-08 14:25:20 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-04-08 14:25:20 +0300
commitd8ab03b03566831cb5dfe8caf4a1e1b77106a342 (patch)
treea4274c4ceaf912afc55d7845d420bcd2b965609f /mailbox/rfc2047.c
parentd1b1cba265616c7b48948c7f27d4a15f335fd6ae (diff)
downloadmailutils-d8ab03b03566831cb5dfe8caf4a1e1b77106a342.tar.gz
mailutils-d8ab03b03566831cb5dfe8caf4a1e1b77106a342.tar.bz2
Bugfix in mu_rfc2047_decode.
* mailbox/rfc2047.c (mu_rfc2047_decode): Use temporary buffer for reading from the filter stream, to avoid preliminary breaking from the read loop when end of the buffer is reached. Realloc the buffer as neccessary.
Diffstat (limited to 'mailbox/rfc2047.c')
-rw-r--r--mailbox/rfc2047.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mailbox/rfc2047.c b/mailbox/rfc2047.c
index 540f80e68..77d02e557 100644
--- a/mailbox/rfc2047.c
+++ b/mailbox/rfc2047.c
@@ -117,7 +117,8 @@ mu_rfc2047_decode (const char *tocode, const char *input, char **ptostr)
const char *filter_type = NULL;
size_t nbytes = 0, size;
const char *sp = fromstr + 2;
-
+ char tmp[128];
+
fromcode = getword (&sp, '?');
encoding_type = getword (&sp, '?');
encoded_text = getword (&sp, '?');
@@ -164,11 +165,14 @@ mu_rfc2047_decode (const char *tocode, const char *input, char **ptostr)
if (status != 0)
break;
- while (mu_stream_sequential_read (filter, buffer + bufpos,
- bufsize - bufpos,
- &nbytes) == 0
+ while (mu_stream_sequential_read (filter, tmp, sizeof (tmp),
+ &nbytes) == 0
&& nbytes)
- bufpos += nbytes;
+ {
+ CHKBUF (nbytes);
+ memcpy (buffer + bufpos, tmp, nbytes);
+ bufpos += nbytes;
+ }
mu_stream_close (filter);
mu_stream_destroy (&filter, mu_stream_get_owner (filter));

Return to:

Send suggestions and report system problems to the System administrator.