dovecot-2.2: imapc: Avoid crashing if server happens to send inv...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 12 23:20:41 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/800a28db8116
changeset: 17466:800a28db8116
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 13 00:51:44 2014 +0300
description:
imapc: Avoid crashing if server happens to send invalid resp-text-codes.
If [KEY VALUE] is missing the VALUE, just set it to "" instead of NULL.
Found by Coverity

diffstat:

 src/lib-imap-client/imapc-connection.c      |  2 +-
 src/lib-storage/index/imapc/imapc-mailbox.c |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 0fc86de05ccf -r 800a28db8116 src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c	Fri Jun 13 00:46:34 2014 +0300
+++ b/src/lib-imap-client/imapc-connection.c	Fri Jun 13 00:51:44 2014 +0300
@@ -630,7 +630,7 @@
 		*value_r = value + 1;
 	} else {
 		*key_r = text;
-		*value_r = NULL;
+		*value_r = "";
 	}
 	return imapc_connection_handle_resp_text_code(conn, *key_r, *value_r);
 }
diff -r 0fc86de05ccf -r 800a28db8116 src/lib-storage/index/imapc/imapc-mailbox.c
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Fri Jun 13 00:46:34 2014 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Fri Jun 13 00:51:44 2014 +0300
@@ -413,7 +413,7 @@
 {
 	uint32_t uid_validity;
 
-	if (mbox == NULL || reply->resp_text_value == NULL ||
+	if (mbox == NULL ||
 	    str_to_uint32(reply->resp_text_value, &uid_validity) < 0)
 		return;
 
@@ -429,7 +429,7 @@
 {
 	uint32_t uid_next;
 
-	if (mbox == NULL || reply->resp_text_value == NULL ||
+	if (mbox == NULL ||
 	    str_to_uint32(reply->resp_text_value, &uid_next) < 0)
 		return;
 


More information about the dovecot-cvs mailing list