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:
martin 2009-10-03 10:06:53 +00:00
parent 64f9578202
commit ab2ed07b78
1 changed files with 4 additions and 4 deletions

View File

@ -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 */