dovecot-2.0: dbox: mail_get_special() for POP3 UIDL or GUID retu...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 25 21:26:37 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/94be7b193c48
changeset: 12353:94be7b193c48
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 25 19:26:34 2010 +0100
description:
dbox: mail_get_special() for POP3 UIDL or GUID return value wasn't permanent enough.
Another call to mail_get_*() could have caused the string to point to some
garbage.

diffstat:

 src/lib-storage/index/dbox-common/dbox-mail.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r f52d4d77f16f -r 94be7b193c48 src/lib-storage/index/dbox-common/dbox-mail.c
--- a/src/lib-storage/index/dbox-common/dbox-mail.c	Mon Oct 25 18:53:04 2010 +0100
+++ b/src/lib-storage/index/dbox-common/dbox-mail.c	Mon Oct 25 19:26:34 2010 +0100
@@ -187,7 +187,12 @@
 		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;
 }
 


More information about the dovecot-cvs mailing list