Only allow custom length for 0x04 instruction

This commit is contained in:
Manuel Thalmann 2023-10-13 01:35:01 +02:00
parent 995ba68bdf
commit e95ded2edf

View file

@ -65,13 +65,14 @@ public class MyApplet extends Applet {
if (instruction == 0x00) { if (instruction == 0x00) {
response = AuthorName; response = AuthorName;
length = (short)response.length;
} else { } else {
response = storage; response = storage;
}
if (length > response.length) { if (length > response.length) {
length = (short) response.length; length = (short) response.length;
} }
}
apdu.setOutgoingLength(length); apdu.setOutgoingLength(length);
apdu.sendBytesLong(response, (short) 0, length); apdu.sendBytesLong(response, (short) 0, length);