dovecot-2.2: imap: Don't crash with invalid FETCH BODY[sections]

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 20 19:18:07 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/ab434891f2af
changeset: 16065:ab434891f2af
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 20 19:18:01 2013 +0200
description:
imap: Don't crash with invalid FETCH BODY[sections]

diffstat:

 src/imap/imap-fetch-body.c          |  2 +-
 src/lib-imap-storage/imap-msgpart.c |  3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 1ae6a51450f2 -r ab434891f2af src/imap/imap-fetch-body.c
--- a/src/imap/imap-fetch-body.c	Wed Mar 20 18:52:51 2013 +0200
+++ b/src/imap/imap-fetch-body.c	Wed Mar 20 19:18:01 2013 +0200
@@ -357,7 +357,7 @@
 	}
 	if (imap_msgpart_parse(body->section, &body->msgpart) < 0) {
 		ctx->error = "Invalid BODY[..] section";
-		return -1;
+		return FALSE;
 	}
 	ctx->fetch_ctx->fetch_data |=
 		imap_msgpart_get_fetch_data(body->msgpart);
diff -r 1ae6a51450f2 -r ab434891f2af src/lib-imap-storage/imap-msgpart.c
--- a/src/lib-imap-storage/imap-msgpart.c	Wed Mar 20 18:52:51 2013 +0200
+++ b/src/lib-imap-storage/imap-msgpart.c	Wed Mar 20 19:18:01 2013 +0200
@@ -288,7 +288,8 @@
 		else
 			msgpart->wanted_fields |= MAIL_FETCH_STREAM_BODY;
 	} else {
-		i_unreached();
+		imap_msgpart_free(&msgpart);
+		return -1;
 	}
 	return 0;
 }


More information about the dovecot-cvs mailing list