Validate the uri received in ApnEditor.

Uri should only refer to telephony carriers and no other provider.

Bug: 11184401
Change-Id: I38c25a37a48883f971c4f405a98db5066a707909
This commit is contained in:
Amit Mahajan
2015-10-28 13:43:01 -07:00
parent a36ac2a772
commit 21742874f7

View File

@@ -203,10 +203,22 @@ public class ApnEditor extends InstrumentedPreferenceActivity
mFirstTime = icicle == null;
if (action.equals(Intent.ACTION_EDIT)) {
mUri = intent.getData();
Uri uri = intent.getData();
if (!uri.isPathPrefixMatch(Telephony.Carriers.CONTENT_URI)) {
Log.e(TAG, "Edit request not for carrier table. Uri: " + uri);
finish();
return;
}
mUri = uri;
} else if (action.equals(Intent.ACTION_INSERT)) {
if (mFirstTime || icicle.getInt(SAVED_POS) == 0) {
mUri = getContentResolver().insert(intent.getData(), new ContentValues());
Uri uri = intent.getData();
if (!uri.isPathPrefixMatch(Telephony.Carriers.CONTENT_URI)) {
Log.e(TAG, "Insert request not for carrier table. Uri: " + uri);
finish();
return;
}
mUri = getContentResolver().insert(uri, new ContentValues());
} else {
mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
icicle.getInt(SAVED_POS));