dovecot: charset_to_utf8_begin() was called with bad flags param...

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 3 14:23:50 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/c68564884bae
changeset: 6910:c68564884bae
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 03 14:23:19 2007 +0200
description:
charset_to_utf8_begin() was called with bad flags parameter (although it
just happened to be the same value, so it worked).

diffstat:

2 files changed, 6 insertions(+), 2 deletions(-)
src/lib-mail/message-decoder.c       |    4 +++-
src/lib-mail/message-header-decode.c |    4 +++-

diffs (42 lines):

diff -r 725a31acbe00 -r c68564884bae src/lib-mail/message-decoder.c
--- a/src/lib-mail/message-decoder.c	Mon Dec 03 14:22:27 2007 +0200
+++ b/src/lib-mail/message-decoder.c	Mon Dec 03 14:23:19 2007 +0200
@@ -214,14 +214,16 @@ static bool message_decode_body(struct m
 				struct message_block *output)
 {
 	unsigned char new_buf[MAX_ENCODING_BUF_SIZE+1];
+	enum charset_flags flags;
 	const unsigned char *data = NULL;
 	size_t pos, size = 0, skip = 0;
 	int ret;
 
 	if (ctx->charset_trans == NULL && !ctx->charset_utf8) {
+		flags = ctx->dtcase ? CHARSET_FLAG_DECOMP_TITLECASE : 0;
 		if (charset_to_utf8_begin(ctx->content_charset != NULL ?
 					  ctx->content_charset : "UTF-8",
-					  ctx->dtcase, &ctx->charset_trans) < 0)
+					  flags, &ctx->charset_trans) < 0)
 			ctx->charset_trans = NULL;
 	}
 
diff -r 725a31acbe00 -r c68564884bae src/lib-mail/message-header-decode.c
--- a/src/lib-mail/message-header-decode.c	Mon Dec 03 14:22:27 2007 +0200
+++ b/src/lib-mail/message-header-decode.c	Mon Dec 03 14:23:19 2007 +0200
@@ -128,6 +128,7 @@ decode_utf8_callback(const unsigned char
 {
 	struct decode_utf8_context *ctx = context;
 	struct charset_translation *t;
+	enum charset_flags flags;
 
 	/* one call with charset=NULL means nothing changed */
 	if (!ctx->called && charset == NULL)
@@ -146,7 +147,8 @@ decode_utf8_callback(const unsigned char
 		return TRUE;
 	}
 
-	if (charset_to_utf8_begin(charset, ctx->dtcase, &t) < 0) {
+	flags = ctx->dtcase ? CHARSET_FLAG_DECOMP_TITLECASE : 0;
+	if (charset_to_utf8_begin(charset, flags, &t) < 0) {
 		/* let's just ignore this part */
 		return TRUE;
 	}


More information about the dovecot-cvs mailing list