dovecot-1.2: fts-solr: Don't break if mailbox name contains '&' ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Nov 30 01:27:25 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/57e704c361a7
changeset: 8494:57e704c361a7
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Nov 29 22:39:04 2008 +0200
description:
fts-solr: Don't break if mailbox name contains '&' characters.

diffstat:

1 file changed, 6 insertions(+), 1 deletion(-)
src/plugins/fts-solr/solr-connection.c |    7 ++++++-

diffs (25 lines):

diff -r 149c6ccc3df4 -r 57e704c361a7 src/plugins/fts-solr/solr-connection.c
--- a/src/plugins/fts-solr/solr-connection.c	Sat Nov 29 19:24:59 2008 +0200
+++ b/src/plugins/fts-solr/solr-connection.c	Sat Nov 29 22:39:04 2008 +0200
@@ -325,6 +325,7 @@ static void solr_lookup_xml_data(void *c
 static void solr_lookup_xml_data(void *context, const char *str, int len)
 {
 	struct solr_lookup_xml_context *ctx = context;
+	char *new_name;
 
 	switch (ctx->content_state) {
 	case SOLR_XML_CONTENT_STATE_NONE:
@@ -339,8 +340,12 @@ static void solr_lookup_xml_data(void *c
 		} T_END;
 		break;
 	case SOLR_XML_CONTENT_STATE_MAILBOX:
+		/* this may be called multiple times, for example if input
+		   contains '&' characters */
+		new_name = ctx->mailbox == NULL ? i_strndup(str, len) :
+			i_strconcat(ctx->mailbox, t_strndup(str, len), NULL);
 		i_free(ctx->mailbox);
-		ctx->mailbox = i_strndup(str, len);
+		ctx->mailbox = new_name;
 		break;
 	case SOLR_XML_CONTENT_STATE_UIDVALIDITY:
 		if (uint32_parse(str, len, &ctx->uidvalidity) < 0)


More information about the dovecot-cvs mailing list