[dovecot-cvs] dovecot/src/lib-mail message-decoder.c,1.7,1.8

tss at dovecot.org tss at dovecot.org
Tue Apr 3 21:02:46 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv5070

Modified Files:
	message-decoder.c 
Log Message:
Fix for base64 handling



Index: message-decoder.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-decoder.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- message-decoder.c	25 Mar 2007 23:45:49 -0000	1.7
+++ message-decoder.c	3 Apr 2007 18:02:44 -0000	1.8
@@ -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;
 		}



More information about the dovecot-cvs mailing list