Merge "Fix an OutOfBoundsException" into jb-ub-mail-ur10

This commit is contained in:
Martin Hibdon 2013-08-20 00:31:23 +00:00 committed by Android (Google) Code Review
commit caf847f1ca

View File

@ -585,13 +585,19 @@ public class Pop3Store extends Store {
try {
int start = ok + 3;
int end = response.indexOf(" ", start);
String intString;
if (start < response.length()) {
// No length was supplied, this is a protocol error.
LogUtils.e(Logging.LOG_TAG, "No body length supplied");
message.setSize(0);
} else {
final String intString;
if (end > 0) {
intString = response.substring(start, end);
} else {
intString = response.substring(start);
}
message.setSize(Integer.parseInt(intString));
}
} catch (NumberFormatException e) {
// We tried
}