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:
Jakub Jelen 2020-04-22 10:03:32 +02:00 committed by Frank Morgner
parent 84ee2be122
commit 508f8a9fce
1 changed files with 1 additions and 1 deletions

View File

@ -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_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);
/* Ignore all but 'corrupted data' errors */
if (r == SC_ERROR_CORRUPTED_DATA)