Merge pull request #637 from germanblanco/sm_get_response_loop_fix

Stop reading a file when an error happened *or* all data requested was read.

Fixes https://github.com/OpenSC/OpenSC/issues/632 , but may need adjustments when used with SM
This commit is contained in:
Frank Morgner 2016-01-15 10:32:46 +01:00
commit a0c0087446
1 changed files with 1 additions and 1 deletions

View File

@ -504,7 +504,7 @@ sc_get_response(struct sc_card *card, struct sc_apdu *apdu, size_t olen)
/* if the card has returned 0x9000 but we still expect data ask for more
* until we have read enough bytes */
le = minlen;
} while (rv != 0 || minlen != 0);
} while (rv != 0 && minlen != 0);
/* we've read all data, let's return 0x9000 */
apdu->resplen = buf - apdu->resp;