Skip to content

Commit

Permalink
imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs
Browse files Browse the repository at this point in the history
The last key with the missing value is just silently ignored.
  • Loading branch information
sirainen committed Feb 27, 2018
1 parent eaf49d9 commit d4d69bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -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) {
Expand Down

0 comments on commit d4d69bc

Please sign in to comment.