mirror of
https://github.com/bitwarden/mobile
synced 2025-12-12 06:13:21 +00:00
Fix Unsafe deserialization of Parcel data Intent (#1691)
* Fix crash produced by unsafe deserialization of Parcel data passed on the intent * Fix crash produced by unsafe deserialization of Parcel data passed on the intent on other activities and renamed intent extension method
This commit is contained in:
committed by
GitHub
parent
705b8ac12b
commit
04c7409418
22
src/Android/Utilities/IntentExtensions.cs
Normal file
22
src/Android/Utilities/IntentExtensions.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
|
||||
namespace Bit.Droid.Utilities
|
||||
{
|
||||
public static class IntentExtensions
|
||||
{
|
||||
public static void Validate(this Intent intent)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check if getting the bundle of the extras causes any exception when unparcelling
|
||||
// Note: getting the bundle like this will cause to call unparcel() internally
|
||||
var b = intent?.Extras?.GetBundle("trashstringwhichhasnousebuttocheckunparcel");
|
||||
}
|
||||
catch (BadParcelableException)
|
||||
{
|
||||
intent.ReplaceExtras((Bundle)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user