]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: mail_get_special() for POP3 UIDL or GUID return value wasn't permanent enough.
authorTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 18:26:34 +0000 (19:26 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 18:26:34 +0000 (19:26 +0100)
Another call to mail_get_*() could have caused the string to point to some
garbage.

src/lib-storage/index/dbox-common/dbox-mail.c

index af378982f5388a933b47aed24c32dec9ab6311ef..7076a6374fa92441b4f2e3f3ef75e50dc416c510 100644 (file)
@@ -187,7 +187,12 @@ dbox_get_cached_metadata(struct dbox_mail *mail, enum dbox_metadata_key key,
                value = "";
        index_mail_cache_add_idx(imail, ibox->cache_fields[cache_field].idx,
                                 value, strlen(value)+1);
-       *value_r = value;
+
+       /* don't return pointer to dbox metadata directly, since it may
+          change unexpectedly */
+       str_truncate(str, 0);
+       str_append(str, value);
+       *value_r = str_c(str);
        return 0;
 }