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

Commit 8d1558d3 authored by Zhihai Xu's avatar Zhihai Xu
Browse files

Bluetooth OPP should sanitize Uri data and MIME types before calling startActivity

bug 5842045

Change-Id: I00a80fc7dc6c6031ab35113539ff6cdf4cf230a6
parent d5a11c1e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ public class BluetoothOppLauncherActivity extends Activity {
            Intent intent1 = new Intent();
            intent1.setAction(action);
            intent1.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent1.setData(uri);
            intent1.setDataAndNormalize(uri);
            this.sendBroadcast(intent1);
        }
        finish();
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public class BluetoothOppLiveFolder extends Activity {
    private static Intent createLiveFolder(Context context, Uri uri, String name, int icon) {
        final Intent intent = new Intent();

        intent.setData(uri);
        intent.setDataAndNormalize(uri);
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT, new Intent(
                Constants.ACTION_OPEN, BluetoothShare.CONTENT_URI));
        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
+3 −3
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ class BluetoothOppNotification {

            Intent intent = new Intent(Constants.ACTION_LIST);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));
            intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));

            b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent, 0));
            mNotificationMgr.notify(item.id, b.getNotification());
@@ -491,7 +491,7 @@ class BluetoothOppNotification {

            Intent intent = new Intent(Constants.ACTION_INCOMING_FILE_CONFIRM);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(contentUri);
            intent.setDataAndNormalize(contentUri);

            n.when = timeStamp;
            n.setLatestEventInfo(mContext, title, caption, PendingIntent.getBroadcast(mContext, 0,
@@ -499,7 +499,7 @@ class BluetoothOppNotification {

            intent = new Intent(Constants.ACTION_HIDE);
            intent.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent.setData(contentUri);
            intent.setDataAndNormalize(contentUri);
            n.deleteIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);

            mNotificationMgr.notify(id, n);
+2 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            Uri uri = intent.getData();
            Intent in = new Intent(context, BluetoothOppIncomingFileConfirmActivity.class);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setData(uri);
            in.setDataAndNormalize(uri);
            context.startActivity(in);

            NotificationManager notMgr = (NotificationManager)context
@@ -157,7 +157,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            } else {
                Intent in = new Intent(context, BluetoothOppTransferActivity.class);
                in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                in.setData(uri);
                in.setDataAndNormalize(uri);
                context.startActivity(in);
            }

+1 −1
Original line number Diff line number Diff line
@@ -289,7 +289,7 @@ public class BluetoothOppTransferHistory extends Activity implements
        } else {
            Intent in = new Intent(this, BluetoothOppTransferActivity.class);
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setData(contentUri);
            in.setDataAndNormalize(contentUri);
            this.startActivity(in);
        }
    }
Loading