diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-05-23 13:24:35 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-05-24 00:46:01 +0400 |
commit | fa5912a17b51b807c4ec78a4aa914891c7770781 (patch) | |
tree | 177da6ded0c502077dc15a98ed653993532bc8bd /libcacard | |
parent | 124fe7fb1b7a1db8cb2ebb9edae84716ffaf37ce (diff) |
libcacard/vreader: Drop broken recovery from failed assertion
We suppress some code when we got unexpected status and assertion
checking is off:
assert(card_status == VCARD_DONE);
if (card_status == VCARD_DONE) {
int size = MIN(*receive_buf_len, response->b_total_len);
memcpy(receive_buf, response->b_data, size);
*receive_buf_len = size;
}
Such "recovery" is of dubious value even when it works. This one
doesn't: it fails to assign to receive_buf[] and *receive_buf_len,
which the callers expect.
Make the code unconditional.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'libcacard')
-rw-r--r-- | libcacard/vreader.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libcacard/vreader.c b/libcacard/vreader.c index 9304a2824d..93b01c8601 100644 --- a/libcacard/vreader.c +++ b/libcacard/vreader.c @@ -284,11 +284,9 @@ vreader_xfr_bytes(VReader *reader, } } assert(card_status == VCARD_DONE); - if (card_status == VCARD_DONE) { - int size = MIN(*receive_buf_len, response->b_total_len); - memcpy(receive_buf, response->b_data, size); - *receive_buf_len = size; - } + int size = MIN(*receive_buf_len, response->b_total_len); + memcpy(receive_buf, response->b_data, size); + *receive_buf_len = size; vcard_response_delete(response); vcard_apdu_delete(apdu); vcard_free(card); /* free our reference */ |