]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 27 Feb 2018 10:26:09 +0000 (12:26 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 27 Feb 2018 14:42:26 +0000 (16:42 +0200)
The last key with the missing value is just silently ignored.

src/lib-storage/index/imapc/imapc-mailbox.c

index 048b037a22ce04cb8a7ff13ad41693a6ddc40c60..c2894da0cc11a1f3369496b8e65907f26b5344c1 100644 (file)
@@ -433,7 +433,8 @@ static void imapc_untagged_fetch(const struct imapc_untagged_reply *reply,
 
        fetch_uid = 0; flags = 0;
        for (i = 0; list[i].type != IMAP_ARG_EOL; i += 2) {
-               if (!imap_arg_get_atom(&list[i], &atom))
+               if (!imap_arg_get_atom(&list[i], &atom) ||
+                   list[i+1].type == IMAP_ARG_EOL)
                        return;
 
                if (strcasecmp(atom, "UID") == 0) {