iso7816: Do not recurse if no data was returned
Thanks oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20399
This commit is contained in:
parent
84ee2be122
commit
508f8a9fce
|
@ -161,7 +161,7 @@ iso7816_read_binary(struct sc_card *card, unsigned int idx, u8 *buf, size_t coun
|
||||||
LOG_FUNC_RETURN(ctx, apdu.resplen);
|
LOG_FUNC_RETURN(ctx, apdu.resplen);
|
||||||
LOG_TEST_RET(ctx, r, "Check SW error");
|
LOG_TEST_RET(ctx, r, "Check SW error");
|
||||||
|
|
||||||
if (apdu.resplen < count) {
|
if (apdu.resplen > 0 && apdu.resplen < count) {
|
||||||
r = iso7816_read_binary(card, idx + apdu.resplen, buf + apdu.resplen, count - apdu.resplen, flags);
|
r = iso7816_read_binary(card, idx + apdu.resplen, buf + apdu.resplen, count - apdu.resplen, flags);
|
||||||
/* Ignore all but 'corrupted data' errors */
|
/* Ignore all but 'corrupted data' errors */
|
||||||
if (r == SC_ERROR_CORRUPTED_DATA)
|
if (r == SC_ERROR_CORRUPTED_DATA)
|
||||||
|
|
Loading…
Reference in New Issue