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:
@@ -203,10 +203,22 @@ public class ApnEditor extends InstrumentedPreferenceActivity
|
|||||||
mFirstTime = icicle == null;
|
mFirstTime = icicle == null;
|
||||||
|
|
||||||
if (action.equals(Intent.ACTION_EDIT)) {
|
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)) {
|
} else if (action.equals(Intent.ACTION_INSERT)) {
|
||||||
if (mFirstTime || icicle.getInt(SAVED_POS) == 0) {
|
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 {
|
} else {
|
||||||
mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
|
mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
|
||||||
icicle.getInt(SAVED_POS));
|
icicle.getInt(SAVED_POS));
|
||||||
|
Reference in New Issue
Block a user