]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 12 Apr 2018 06:06:59 +0000 (09:06 +0300)
The last key with the missing value is just silently ignored.

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

index 13392cf2e1c4d1a2d46c8afc8f2dd2cfbeb4aedc..57dac046a9071a989702806ddf1bfa347e550dd5 100644 (file)
@@ -437,7 +437,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) {