mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 12:48:33 +00:00
Validate recipients at send time rather than when constructed.
Fixes #665
This commit is contained in:
@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.sms.MultipartSmsMessageHandler;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingPrekeyBundleMessage;
|
||||
import org.thoughtcrime.securesms.sms.OutgoingTextMessage;
|
||||
import org.thoughtcrime.securesms.sms.SmsTransportDetails;
|
||||
import org.thoughtcrime.securesms.util.NumberUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.whispersystems.textsecure.crypto.SessionCipher;
|
||||
@@ -54,6 +55,10 @@ public class SmsTransport extends BaseTransport {
|
||||
throw new UndeliverableMessageException("SMS Transport is not enabled!");
|
||||
}
|
||||
|
||||
if (!NumberUtil.isValidSmsOrEmail(message.getIndividualRecipient().getNumber())) {
|
||||
throw new UndeliverableMessageException("Not a valid SMS destination! " + message.getIndividualRecipient().getNumber());
|
||||
}
|
||||
|
||||
if (message.isSecure() || message.isKeyExchange() || message.isEndSession()) {
|
||||
deliverSecureMessage(message);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user