From 5d968b7c40bfd4344fd543e0513204c5d17fe291 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 11 Oct 2020 16:51:49 +0300 Subject: [PATCH] imap: fix out of bounds panic on receive EXPUNGE Closes #82 --- melib/src/backends/imap/untagged.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/melib/src/backends/imap/untagged.rs b/melib/src/backends/imap/untagged.rs index 536b18b3..27fcf570 100644 --- a/melib/src/backends/imap/untagged.rs +++ b/melib/src/backends/imap/untagged.rs @@ -95,7 +95,7 @@ impl ImapConnection { .unwrap() .entry(mailbox_hash) .or_default() - .remove(n.try_into().unwrap()); + .remove(TryInto::::try_into(n).unwrap().saturating_sub(1)); debug!("expunge {}, UID = {}", n, deleted_uid); let deleted_hash: crate::email::EnvelopeHash = match self .uid_store