From f11f0fcc9bc11f91f0f7ab80193758dc0cced60a Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 20 Aug 2013 18:39:20 +0200 Subject: [PATCH] Skip incorrectly formatted/parsed LSUB/LIST replies Example: * LIST (\HasChildren) "." [Folder] "[Folder]" will be parsed as list containing the element "Folder". --- src/com/fsck/k9/mail/store/ImapStore.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 2a876ce7d..e95ab2294 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -566,6 +566,12 @@ public class ImapStore extends Store { if (ImapResponseParser.equalsIgnoreCase(response.get(0), commandResponse)) { boolean includeFolder = true; + if (response.size() > 4 || !(response.getObject(3) instanceof String)) { + Log.w(K9.LOG_TAG, "Skipping incorrectly parsed " + commandResponse + + " reply: " + response); + continue; + } + String decodedFolderName; try { decodedFolderName = decodeFolderName(response.getString(3));