taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit be9add0fcd8f7deae44ca8f5f9910b96214fdf83
parent 666387dd465ebfc651137433d54ec0a837b2f566
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 20 Aug 2026 19:39:44 +0200

AI: index

Diffstat:
MTalerCommon/Helper/apdu.swift | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/TalerCommon/Helper/apdu.swift b/TalerCommon/Helper/apdu.swift @@ -249,7 +249,11 @@ class APDU { guard commandApdu.count >= 2 else { return A_ERROR } /// Sixth (and seventh) Command: Read the NDEF File // 00b0 00 02 3b, and 00b0 00 3d 27 - if NDEF_READ_BINARY == commandApdu[0..<2] { + let start = commandApdu.startIndex + // a Data slice's valid indices need not start at 0, and subscripting with an absolute range + // would crash if they didn't. + let prefixEnd = commandApdu.index(start, offsetBy: 2) + if NDEF_READ_BINARY == commandApdu[start..<prefixEnd] { let count = commandApdu.count if count > 4 { var arrayApdu = Array<UInt8>(repeating: 0, count: count)