Fix #257 Reading partial objects differs for T=0 vs T=1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4761 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
573a1de4d6
commit
10a5d1be3a
|
@ -473,7 +473,11 @@ static int do_single_transmit(sc_card_t *card, sc_apdu_t *apdu)
|
||||||
/* 0x6100 means at least 256 more bytes to read */
|
/* 0x6100 means at least 256 more bytes to read */
|
||||||
le = apdu->sw2 != 0 ? (size_t)apdu->sw2 : 256;
|
le = apdu->sw2 != 0 ? (size_t)apdu->sw2 : 256;
|
||||||
/* we try to read at least as much as bytes as
|
/* we try to read at least as much as bytes as
|
||||||
* promised in the response bytes */
|
* promised in the response bytes, but not more then
|
||||||
|
* then requested. So now T=0 responds the same as T=1
|
||||||
|
*/
|
||||||
|
if (buflen < le)
|
||||||
|
le = buflen;
|
||||||
minlen = le;
|
minlen = le;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -492,6 +496,11 @@ static int do_single_transmit(sc_card_t *card, sc_apdu_t *apdu)
|
||||||
buf += le;
|
buf += le;
|
||||||
buflen -= le;
|
buflen -= le;
|
||||||
|
|
||||||
|
/* we have all the data the caller requested
|
||||||
|
* even if the card has more data */
|
||||||
|
if (buflen == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
minlen -= le;
|
minlen -= le;
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
le = minlen = (size_t)r;
|
le = minlen = (size_t)r;
|
||||||
|
|
Loading…
Reference in New Issue