Fix potential ArrayIndexOutOfBoundsException.
When parsing an SMS message as email, extractEmailAddressFromMessageBody() checks parts.length >= 1, but then proceeds to access parts[1] (which may not exist). Instead, check for parts.length >= 2, and treat parts.length = 1 as non-email. b/2122698
This commit is contained in:
@@ -383,7 +383,7 @@ public abstract class SmsMessageBase {
|
||||
* 2. [x@y][ ]/[body]
|
||||
*/
|
||||
String[] parts = messageBody.split("( /)|( )", 2);
|
||||
if (parts.length < 1) return;
|
||||
if (parts.length < 2) return;
|
||||
emailFrom = parts[0];
|
||||
emailBody = parts[1];
|
||||
isEmail = true;
|
||||
|
||||
Reference in New Issue
Block a user