Skip to content

Commit 90dd4cb

Browse files
authored
Merge pull request #472 from balazsgerlei/handle-exceptions-during-intent-parsing
Handle Exceptions during Intent parsing logic to avoid DoS on Android
2 parents 1038f4c + 487c5de commit 90dd4cb

File tree

1 file changed

+11
-7
lines changed
  • androidApp/src/androidMain/kotlin/org/jetbrains/kotlinconf/android

1 file changed

+11
-7
lines changed

androidApp/src/androidMain/kotlin/org/jetbrains/kotlinconf/android/MainActivity.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,18 @@ class MainActivity : ComponentActivity() {
6868
private fun processIntent(intent: Intent?) {
6969
if (intent == null) return
7070

71-
val notificationId = intent.getStringExtra(EXTRA_LOCAL_NOTIFICATION_ID)
72-
if (notificationId != null) {
73-
// Local notification clicked
74-
navigateByLocalNotificationId(notificationId)
71+
try {
72+
val notificationId = intent.getStringExtra(EXTRA_LOCAL_NOTIFICATION_ID)
73+
if (notificationId != null) {
74+
// Local notification clicked
75+
navigateByLocalNotificationId(notificationId)
76+
return
77+
}
78+
79+
// Process push notifications
80+
NotifierManager.onCreateOrOnNewIntent(intent)
81+
} catch (e: Exception) {
7582
return
7683
}
77-
78-
// Process push notifications
79-
NotifierManager.onCreateOrOnNewIntent(intent)
8084
}
8185
}

0 commit comments

Comments
 (0)