Skip to content

Commit

Permalink
libcacard/vreader: Drop broken recovery from failed assertion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Armbruster authored and Michael Tokarev committed May 23, 2014
1 parent 124fe7f commit fa5912a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions libcacard/vreader.c
Expand Up @@ -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 */
Expand Down

0 comments on commit fa5912a

Please sign in to comment.