瀏覽代碼

core: TelephonyManagerApduInterface: convert to UByte first

Otherwise, the integer representation will be negative when the byte
value is greater than 127.
Peter Cai 2 年之前
父節點
當前提交
58bd80556a
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt

+ 5 - 5
app/src/main/java/im/angry/openeuicc/core/TelephonyManagerApduInterface.kt

@@ -42,11 +42,11 @@ class TelephonyManagerApduInterface(
     override fun transmit(tx: ByteArray): ByteArray {
         check(lastChannel != -1) { "Uninitialized" }
 
-        val cla = tx[0].toInt()
-        val instruction = tx[1].toInt()
-        val p1 = tx[2].toInt()
-        val p2 = tx[3].toInt()
-        val p3 = tx[4].toInt()
+        val cla = tx[0].toUByte().toInt()
+        val instruction = tx[1].toUByte().toInt()
+        val p1 = tx[2].toUByte().toInt()
+        val p2 = tx[3].toUByte().toInt()
+        val p3 = tx[4].toUByte().toInt()
         val p4 = tx.drop(5).toByteArray().encodeHex()
 
         return tm.iccTransmitApduLogicalChannelBySlot(info.slotId, lastChannel,