dovecot-2.2: lib-imap-urlauth: Don't try to access garbage memor...

dovecot at dovecot.org dovecot at dovecot.org
Mon May 6 18:36:10 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/a45bfb4c7d66
changeset: 16334:a45bfb4c7d66
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 06 18:35:36 2013 +0300
description:
lib-imap-urlauth: Don't try to access garbage memory on error handling paths.

diffstat:

 src/lib-imap-urlauth/imap-urlauth-fetch.c |  2 +-
 src/lib-imap-urlauth/imap-urlauth.c       |  5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 63555663efbc -r a45bfb4c7d66 src/lib-imap-urlauth/imap-urlauth-fetch.c
--- a/src/lib-imap-urlauth/imap-urlauth-fetch.c	Mon May 06 17:30:07 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c	Mon May 06 18:35:36 2013 +0300
@@ -150,7 +150,7 @@
 	const char *error, *errormsg = NULL, *bpstruct = NULL;
 	bool debug = ufetch->uctx->user->mail_debug, success;
 	enum mail_error error_code;
-	struct imap_msgpart_url *mpurl;
+	struct imap_msgpart_url *mpurl = NULL;
 	int ret;
 
 	ufetch->pending_requests--;
diff -r 63555663efbc -r a45bfb4c7d66 src/lib-imap-urlauth/imap-urlauth.c
--- a/src/lib-imap-urlauth/imap-urlauth.c	Mon May 06 17:30:07 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth.c	Mon May 06 18:35:36 2013 +0300
@@ -227,7 +227,7 @@
 	enum imap_url_parse_flags url_flags =
 		IMAP_URL_PARSE_ALLOW_URLAUTH;
 	struct imap_url *url;
-	struct imap_msgpart_url *mpurl;
+	struct imap_msgpart_url *mpurl = NULL;
 	struct mailbox *box;
 	const char *error;
 	enum mail_error error_code;
@@ -284,7 +284,8 @@
 	if ((ret = imap_msgpart_url_create(user, url, &mpurl, &error)) < 0 ||
 	    imap_msgpart_url_verify(mpurl, &error) <= 0) {
 		*error_r = t_strdup_printf("Invalid URL: %s", error);
-		imap_msgpart_url_free(&mpurl);
+		if (mpurl != NULL)
+			imap_msgpart_url_free(&mpurl);
 		return ret;
 	}
 	box = imap_msgpart_url_get_mailbox(mpurl);


More information about the dovecot-cvs mailing list