aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index beff671e96..328a6dfce3 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -427,13 +427,15 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
{
register unsigned char *outptr, *bufptr;
register guint32 saved;
- int uulen, i;
+ int uulen, uufill, i;
outptr = out;
if (len > 0)
outptr += uuencode_step (in, len, out, uubuf, state, save);
+ uufill = 0;
+
saved = *save;
i = *state & 0xff;
uulen = (*state >> 8) & 0xff;
@@ -443,6 +445,7 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
if (i > 0) {
while (i < 3) {
saved <<= 8 | 0;
+ uufill++;
i++;
}
@@ -468,7 +471,7 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
if (uulen > 0) {
int cplen = ((uulen / 3) * 4);
- *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff);
+ *outptr++ = CAMEL_UUENCODE_CHAR ((uulen - uufill) & 0xff);
memcpy (outptr, uubuf, cplen);
outptr += cplen;
*outptr++ = '\n';