fix signed byte used for array slice with + added test

This commit is contained in:
Fernando Martins
2023-08-07 11:56:11 +02:00
parent ddcff8fa15
commit 9573b4abec
2 changed files with 10 additions and 1 deletions
@@ -21,7 +21,7 @@ object Tlv {
var rest = data
while (rest.isNotEmpty()) {
val t = rest[0]
val l = rest[1]
val l = rest[1].toUByte().toInt()
val v = rest.sliceArray(IntRange(2, (2 + l) - 1))
rest = rest.sliceArray(IntRange(2 + l, rest.size - 1))
if (v.size < l) continue