Fix APDU sanity check.
By Emanuele Pucciarelli, http://itacns.corp.it/hg/itacns/file/adc0b2ceec86/patches/010-apdu.patch git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3752 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
64f9578202
commit
ab2ed07b78
|
@ -300,15 +300,15 @@ static int sc_check_apdu(sc_card_t *card, const sc_apdu_t *apdu)
|
|||
goto error;
|
||||
break;
|
||||
case SC_APDU_CASE_3_SHORT:
|
||||
/* inconsistent datalen */
|
||||
if (apdu->datalen != apdu->lc)
|
||||
goto error;
|
||||
/* data is send */
|
||||
if (apdu->datalen == 0 || apdu->data == NULL || apdu->lc == 0)
|
||||
if (apdu->datalen != 0 && apdu->data == NULL)
|
||||
goto error;
|
||||
/* no data is expected */
|
||||
if (apdu->le != 0)
|
||||
goto error;
|
||||
/* inconsistent datalen */
|
||||
if (apdu->datalen != apdu->lc)
|
||||
goto error;
|
||||
break;
|
||||
case SC_APDU_CASE_4_SHORT:
|
||||
/* data is send */
|
||||
|
|
Loading…
Reference in New Issue