Mercurial > dovecot > core-2.2
diff src/lib-mail/message-decoder.c @ 5510:93e9e081855a HEAD
Fix for base64 handling
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 03 Apr 2007 21:02:44 +0300 |
parents | 01c63c0adc3b |
children | 518a77f3bf49 |
line wrap: on
line diff
--- a/src/lib-mail/message-decoder.c Tue Apr 03 20:42:30 2007 +0300 +++ b/src/lib-mail/message-decoder.c Tue Apr 03 21:02:44 2007 +0300 @@ -210,6 +210,7 @@ const unsigned char *data = NULL; size_t pos, size = 0, skip = 0; bool unknown_charset; + int ret; if (ctx->charset_trans == NULL && !ctx->charset_utf8) { ctx->charset_trans = @@ -264,14 +265,14 @@ i_assert(pos >= ctx->encoding_size); skip = pos - ctx->encoding_size; } - if (base64_decode(input->data + skip, input->size - skip, - &pos, ctx->buf) < 0) { + ret = base64_decode(input->data + skip, input->size - skip, + &pos, ctx->buf); + if (ret < 0) { /* corrupted base64 data, don't bother with the rest of it */ return FALSE; } - if (pos < input->size - skip && pos > 0 && - input->data[pos + skip - 1] == '=') { + if (ret == 0) { /* end of base64 input */ pos = input->size - skip; }