licel / jcardsim

https://jcardsim.org
223 stars 123 forks source link

short javacard.framework.APDU.setIncomingAndReceive() returns negative values if more than 128 Bytes are received. #24

Open licel opened 11 years ago

licel commented 11 years ago

From petermah...@gmail.com on October 02, 2013 21:30:03

The method short javacard.framework.APDU.setIncomingAndReceive() returns negative values if more than 128 Bytes are received. Seems like a problem with casting a byte to a short variable.

As a workaround I use a method like this: private short apduSetIncomingAndReceive(APDU apdu){ short len = apdu.setIncomingAndReceive(); if (len < 0){ len = (short) (len & 0xff); } return len; }

Original issue: http://code.google.com/p/jcardsim/issues/detail?id=24

klali commented 10 years ago

I think this is the same issue as fixed in issue #27