changeset 22906:8fc3c7215f29

imapc: Fix crash when untagged FETCH reply doesn't have key-value pairs The last key with the missing value is just silently ignored.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 27 Feb 2018 12:26:09 +0200
parents 59c3c804bffa
children 8b32d37472a0
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Mar 26 00:01:26 2018 +0300
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Tue Feb 27 12:26:09 2018 +0200
@@ -437,7 +437,8 @@
 
 	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) {