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 * 0| 0 body type
body subtype * 1| 1 body subtype
body parameter parenthesized list * 2| 2 body parameter parenthesized list
body id * 3| 3 body id (unused)
body description * 4| 4 body description (unused)
body encoding * 5| 5 body encoding
body size * 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 type = bs.getString(0);
String subType = bs.getString(1); String subType = bs.getString(1);
String mimeType = (type + "/" + subType).toLowerCase(); String mimeType = (type + "/" + subType).toLowerCase();
@ -1508,11 +1513,11 @@ public class ImapStore extends Store {
// Extension items // Extension items
ImapList bodyDisposition = null; ImapList bodyDisposition = null;
if (("text".equalsIgnoreCase(type)) if (("text".equalsIgnoreCase(type))
&& (bs.size() > 8) && (bs.size() > 9)
&& (bs.get(9) instanceof ImapList)) { && (bs.get(9) instanceof ImapList)) {
bodyDisposition = bs.getList(9); bodyDisposition = bs.getList(9);
} else if (!("text".equalsIgnoreCase(type)) } else if (!("text".equalsIgnoreCase(type))
&& (bs.size() > 7) && (bs.size() > 8)
&& (bs.get(8) instanceof ImapList)) { && (bs.get(8) instanceof ImapList)) {
bodyDisposition = bs.getList(8); bodyDisposition = bs.getList(8);
} }