]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Avoid crashing if server happens to send invalid resp-text-codes.
authorTimo Sirainen <tss@iki.fi>
Thu, 12 Jun 2014 21:51:44 +0000 (00:51 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 12 Jun 2014 21:51:44 +0000 (00:51 +0300)
If [KEY VALUE] is missing the VALUE, just set it to "" instead of NULL.
Found by Coverity

src/lib-imap-client/imapc-connection.c
src/lib-storage/index/imapc/imapc-mailbox.c

index bffcfa718c20c8502a9eebe0a56d18a79fe1a2d0..7d0d1d681bf4c0a6944acdc1e927fe583235ebb0 100644 (file)
@@ -630,7 +630,7 @@ imapc_connection_handle_resp_text(struct imapc_connection *conn,
                *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);
 }
index 36c51d8ffd3bd6f307b674a87cb645ab449c27c1..7b7eb23498149dd449e23f13880f14bb7ca2c407 100644 (file)
@@ -413,7 +413,7 @@ imapc_resp_text_uidvalidity(const struct imapc_untagged_reply *reply,
 {
        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 @@ imapc_resp_text_uidnext(const struct imapc_untagged_reply *reply,
 {
        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;