1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Fix length-check of BODYSTRUCTURE reply

Fixes issue 3116
This commit is contained in:
cketti 2011-03-15 08:34:38 +01:00
parent e2a7a55cf3
commit 330737c4c6

View File

@ -1453,16 +1453,21 @@ public class ImapStore extends Store {
*/
/*
body type
body subtype
body parameter parenthesized list
body id
body description
body encoding
body size
* 0| 0 body type
* 1| 1 body subtype
* 2| 2 body parameter parenthesized list
* 3| 3 body id (unused)
* 4| 4 body description (unused)
* 5| 5 body encoding
* 6| 6 body size
* -| 7 text lines (only for type TEXT, unused)
* Extensions (optional):
* 7| 8 body MD5 (unused)
* 8| 9 body disposition
* 9|10 body language (unused)
* 10|11 body location (unused)
*/
String type = bs.getString(0);
String subType = bs.getString(1);
String mimeType = (type + "/" + subType).toLowerCase();
@ -1508,11 +1513,11 @@ public class ImapStore extends Store {
// Extension items
ImapList bodyDisposition = null;
if (("text".equalsIgnoreCase(type))
&& (bs.size() > 8)
&& (bs.size() > 9)
&& (bs.get(9) instanceof ImapList)) {
bodyDisposition = bs.getList(9);
} else if (!("text".equalsIgnoreCase(type))
&& (bs.size() > 7)
&& (bs.size() > 8)
&& (bs.get(8) instanceof ImapList)) {
bodyDisposition = bs.getList(8);
}