dovecot-2.0: lib-storage: Human search parser now fails if given...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 28 14:31:24 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/046948ccdbfb
changeset: 11412:046948ccdbfb
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 28 12:31:05 2010 +0100
description:
lib-storage: Human search parser now fails if given mailbox name isn't valid UTF8.

diffstat:

 src/lib-storage/mail-search-register-human.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 6f4bfa83aabd -r 046948ccdbfb src/lib-storage/mail-search-register-human.c
--- a/src/lib-storage/mail-search-register-human.c	Fri May 28 12:27:58 2010 +0100
+++ b/src/lib-storage/mail-search-register-human.c	Fri May 28 12:31:05 2010 +0100
@@ -135,17 +135,24 @@
 human_search_mailbox(struct mail_search_build_context *ctx)
 {
 	struct mail_search_arg *sarg;
+	const char *value;
 
 	sarg = mail_search_build_str(ctx, SEARCH_MAILBOX_GLOB);
+	value = sarg->value.str;
+
 	T_BEGIN {
 		string_t *str = t_str_new(128);
 
-		if (imap_utf8_to_utf7(sarg->value.str, str) < 0) {
-			str_truncate(str, 0);
-			str_append(str, sarg->value.str);
-		}
-		sarg->value.str = p_strdup(ctx->pool, str_c(str));
+		if (imap_utf8_to_utf7(value, str) < 0)
+			sarg->value.str = NULL;
+		else
+			sarg->value.str = p_strdup(ctx->pool, str_c(str));
 	} T_END;
+	if (sarg->value.str == NULL) {
+		ctx->_error = p_strconcat(ctx->pool,
+			"Mailbox name not valid UTF-8: ", value, NULL);
+		return NULL;
+	}
 	return sarg;
 }
 


More information about the dovecot-cvs mailing list