From 59d09b30c1a845e3a6a1c88dff769ba8b5ffe590 Mon Sep 17 00:00:00 2001 From: Rafa Hernandez Date: Thu, 2 Nov 2017 13:28:06 -0400 Subject: [PATCH] fix(enroll): validate if base64 decode fail --- .../flyve/mdm/agent/ui/StartEnrollmentActivity.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/flyve/mdm/agent/ui/StartEnrollmentActivity.java b/app/src/main/java/org/flyve/mdm/agent/ui/StartEnrollmentActivity.java index 73998f42cd..018d079a26 100644 --- a/app/src/main/java/org/flyve/mdm/agent/ui/StartEnrollmentActivity.java +++ b/app/src/main/java/org/flyve/mdm/agent/ui/StartEnrollmentActivity.java @@ -87,7 +87,16 @@ protected void onCreate(Bundle savedInstanceState) { Intent intent = getIntent(); Uri data = intent.getData(); - String deepLinkData = Helpers.base64decode(data.getQueryParameter("data")); + String deepLinkErrorMessage = getResources().getString(R.string.ERROR_DEEP_LINK); + String deepLinkData; + + try { + deepLinkData = Helpers.base64decode(data.getQueryParameter("data")); + } catch(Exception ex) { + showError( deepLinkErrorMessage ); + FlyveLog.e(deepLinkErrorMessage + " - " + ex.getMessage()); + return; + } String url; String userToken; @@ -96,7 +105,6 @@ protected void onCreate(Bundle savedInstanceState) { String phone; String website; String email; - String deepLinkErrorMessage = getResources().getString(R.string.ERROR_DEEP_LINK); try { // CSV comma-separated values format