From cefd7ff20f74139f276f801f31d52cf65fa97e0d Mon Sep 17 00:00:00 2001 From: Bron Gondwana Date: Tue, 21 Jan 2025 11:18:00 +1100 Subject: [PATCH] index: don't crash on parts without a type --- imap/index.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imap/index.c b/imap/index.c index fa65732019..b425886c4f 100644 --- a/imap/index.c +++ b/imap/index.c @@ -6097,9 +6097,12 @@ EXPORTED int index_getsearchtext(message_t *msg, const strarray_t *partids, if (!message_get_leaf_types(msg, &types) && types.count) { for (i = 0 ; i < types.count ; i+= 2) { + if (!types.data[i]) continue; buf_setcstr(&buf, types.data[i]); - buf_putc(&buf, '/'); - buf_appendcstr(&buf, types.data[i+1]); + if (types.data[i+1]) { + buf_putc(&buf, '/'); + buf_appendcstr(&buf, types.data[i+1]); + } stuff_part(receiver, str.conv, SEARCH_PART_TYPE, &buf); } }