From: Timo Sirainen Date: Tue, 27 Feb 2018 10:26:09 +0000 (+0200) Subject: imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs X-Git-Tag: 2.3.9~2217 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4d69bc7603dc65fac4f7eed755f8ed5e7fd0788;p=thirdparty%2Fdovecot%2Fcore.git imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs The last key with the missing value is just silently ignored. --- diff --git a/src/lib-storage/index/imapc/imapc-mailbox.c b/src/lib-storage/index/imapc/imapc-mailbox.c index 048b037a22..c2894da0cc 100644 --- a/src/lib-storage/index/imapc/imapc-mailbox.c +++ b/src/lib-storage/index/imapc/imapc-mailbox.c @@ -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) {