Fixed security vulnerability in the intent selector
This commit is contained in:
parent
1c96b62eb6
commit
577efb76a4
@ -7,6 +7,7 @@ import android.content.IntentFilter;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
@ -39,6 +40,12 @@ public class IntentUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||||
|
intent.setComponent(null);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
|
||||||
|
intent.setSelector(null);
|
||||||
|
}
|
||||||
|
|
||||||
if (mActivity.getPackageManager().resolveActivity(intent, 0) == null) {
|
if (mActivity.getPackageManager().resolveActivity(intent, 0) == null) {
|
||||||
String packagename = intent.getPackage();
|
String packagename = intent.getPackage();
|
||||||
if (packagename != null) {
|
if (packagename != null) {
|
||||||
@ -51,8 +58,6 @@ public class IntentUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
|
||||||
intent.setComponent(null);
|
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
intent.putExtra(mActivity.getPackageName() + ".Origin", 1);
|
intent.putExtra(mActivity.getPackageName() + ".Origin", 1);
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,11 @@ class LightningWebClient extends WebViewClient {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
|
intent.addCategory(Intent.CATEGORY_BROWSABLE);
|
||||||
|
intent.setComponent(null);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
|
||||||
|
intent.setSelector(null);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user