dovecot-2.0: lmtp: Don't access freed memory if input couldn't b...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 16 02:21:39 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/d44e64390bdd
changeset: 12287:d44e64390bdd
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 16 00:21:35 2010 +0100
description:
lmtp: Don't access freed memory if input couldn't be opened as raw mail.
This shouldn't really have ever happened.

diffstat:

 src/lmtp/commands.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (25 lines):

diff -r 0d689c112c6e -r d44e64390bdd src/lmtp/commands.c
--- a/src/lmtp/commands.c	Fri Oct 15 19:50:51 2010 +0100
+++ b/src/lmtp/commands.c	Sat Oct 16 00:21:35 2010 +0100
@@ -574,10 +574,9 @@
 	struct mailbox_header_lookup_ctx *headers_ctx;
 	enum mail_error error;
 
-	client->state.raw_box = box =
-		mailbox_alloc(client->raw_mail_user->namespaces->list,
-			      "Dovecot Delivery Mail",
-			      MAILBOX_FLAG_NO_INDEX_FILES);
+	box = mailbox_alloc(client->raw_mail_user->namespaces->list,
+			    "Dovecot Delivery Mail",
+			    MAILBOX_FLAG_NO_INDEX_FILES);
 	if (mailbox_open_stream(box, input) < 0 ||
 	    mailbox_sync(box, 0) < 0) {
 		i_error("Can't open delivery mail as raw: %s",
@@ -589,6 +588,7 @@
 	raw_box = (struct raw_mailbox *)box;
 	raw_box->envelope_sender = client->state.mail_from;
 
+	client->state.raw_box = box;
 	client->state.raw_trans = mailbox_transaction_begin(box, 0);
 
 	headers_ctx = mailbox_header_lookup_init(box, wanted_headers);


More information about the dovecot-cvs mailing list