Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d0655a0 authored by Grace Jia's avatar Grace Jia
Browse files

Check calling package before send sms text.

Prevent third-party app checking if a provider installed by trying to
send text message.

Bug: 193436376
Test: Unit test, manually test with debug app
Change-Id: Iabbe070c58eefeec8c796628b2cf381bf90c4889
parent 039dec8c
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -529,6 +529,10 @@ public class SmsController extends ISmsImplBase {
            Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
            Uri messageUri, String scAddress, List<PendingIntent> sentIntents,
            List<PendingIntent> deliveryIntents) {
            List<PendingIntent> deliveryIntents) {
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (!getCallingPackage().equals(callingPkg)) {
            throw new SecurityException("sendStoredMultipartText: Package " + callingPkg
                    + " does not belong to " + Binder.getCallingUid());
        }
        if (iccSmsIntMgr != null) {
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendStoredMultipartText(callingPkg, callingAttributionTag, messageUri,
            iccSmsIntMgr.sendStoredMultipartText(callingPkg, callingAttributionTag, messageUri,
                    scAddress, sentIntents, deliveryIntents);
                    scAddress, sentIntents, deliveryIntents);