Hi!

I think that there is bug in the opencard.core.terminal.CardID class,
especially, when the class return the historicals bytes. The code is below:
public CardID (byte[] answerToResetResponse)
    throws CardTerminalException {
    atr = (byte[]) answerToResetResponse.clone();
    // ... assert minimum length: TS + T0 character must be present
    if (atr.length < 2)
      throw new CardTerminalException
        ("Illegal ATR response (length " + atr.length +
         " < 2): " + HexString.hexify(answerToResetResponse));
    if ((atr[1] & 0x0f) > 0) {
      historicals = new byte[atr[1] & 0x0f];
      // retrieve the historical bytes
      System.arraycopy(atr, atr.length - 1 - historicals.length,
                       historicals, 0, historicals.length);
      int histCtr = historicals.length-1;
    }
  }
I think that the historical bytes are copied from ATRs beginning in wrong
offset (now it is (atr.length - 1 - historicals.length)). It should be
(atr.length - historicals.length).
Comments?
MaSi 

----------------------------------------------------------------------------
---------
Markku Siev�nen      Tel: +358 9 8941 4253
Setec Oy                      Fax: +358 9 8941 4137
P. O. Box 31                 E-mail: [EMAIL PROTECTED]
FIN-01741 Vantaa
Finland



---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

Reply via email to