# HG changeset patch # User Timo Sirainen # Date 1227991144 -7200 # Node ID 57e704c361a7caa0b5ce7baa2c4d037b689b350e # Parent 149c6ccc3df43b1ed907e9477626b47775dd14c6 fts-solr: Don't break if mailbox name contains '&' characters. 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 *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 @@ } 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)