wrong usage of switch statement prevents applets with size <256 byte from uploading on card.
// Enough space left to start load file data block
if ((MAX_APDU_DATA_SIZE_FOR_SECURE_MESSAGING-j) > fileSizeSize+1+1) { // At least one byte of the load file data block must be sent.
sendBuffer[5+j++] = 0xC4;
switch(fileSizeSize) {
case 1: {
sendBuffer[5+j++] = (BYTE)loadFileBufSize;
break; // bugfix
}
case 2: {
sendBuffer[5+j++] = 0x81;
sendBuffer[5+j++] = (BYTE)loadFileBufSize;
break; // bugfix
}
case 3: {
sendBuffer[5+j++] = 0x82;
sendBuffer[5+j++] = (BYTE)(loadFileBufSize >> 8);
sendBuffer[5+j++] = (BYTE)(loadFileBufSize - (sendBuffer[5+j-1] << 8));
}
}
wrong usage of switch statement prevents applets with size <256 byte from uploading on card.
Reported by: *anonymous