dovecot-2.2: dbox: mail_get_special() may have returned MAIL_FET...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 26 14:29:01 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/55041cf555b7
changeset: 17517:55041cf555b7
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 26 17:27:22 2014 +0300
description:
dbox: mail_get_special() may have returned MAIL_FETCH_POP3_ORDER allocated from data stack.
Although this seems to have worked for now, it shouldn't have been done.

diffstat:

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

diffs (21 lines):

diff -r 705fd8f3f485 -r 55041cf555b7 src/lib-storage/index/dbox-common/dbox-mail.c
--- a/src/lib-storage/index/dbox-common/dbox-mail.c	Wed Jun 25 16:16:02 2014 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-mail.c	Thu Jun 26 17:27:22 2014 +0300
@@ -171,13 +171,13 @@
 	if (mail_cache_lookup_field(imail->mail.mail.transaction->cache_view,
 				    str, imail->mail.mail.seq,
 				    ibox->cache_fields[cache_field].idx) > 0) {
-		if (cache_field != MAIL_CACHE_POP3_ORDER)
-			*value_r = str_c(str);
-		else {
+		if (cache_field == MAIL_CACHE_POP3_ORDER) {
 			i_assert(str_len(str) == sizeof(order));
 			memcpy(&order, str_data(str), sizeof(order));
-			*value_r = order == 0 ? "" : dec2str(order);
+			str_truncate(str, 0);
+			str_printfa(str, "%u", order);
 		}
+		*value_r = str_c(str);
 		return 0;
 	}
 


More information about the dovecot-cvs mailing list