Skip to content

Commit

Permalink
Merge pull request #161 from knthm/fix-mifare-classic-sector-0-auth
Browse files Browse the repository at this point in the history
fix: MIFARE Classic: allow sector 0 authentication
  • Loading branch information
Harry-Chen committed May 21, 2024
2 parents 43a4937 + 8c7e54a commit 5ce2f05
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,9 @@ class FlutterNfcKitPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
return
}
val index = call.argument<Int>("index")!!
if (!(0 < index && index < mifareInfo!!.sectorCount!!)) {
result.error("400", "Invalid sector index $index", null)
val maxSector = mifareInfo!!.sectorCount!!
if (index !in 0 until maxSector) {
result.error("400", "Invalid sector index $index, should be in (0, $maxSector)", null)
return
}
val keyA = call.argument<Any>("keyA")
Expand Down

0 comments on commit 5ce2f05

Please sign in to comment.