From d4d69bc7603dc65fac4f7eed755f8ed5e7fd0788 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 27 Feb 2018 12:26:09 +0200 Subject: [PATCH] imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs The last key with the missing value is just silently ignored. --- src/lib-storage/index/imapc/imapc-mailbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) {