cac: Avoid segfaults from get_challenge()

This commit is contained in:
Jakub Jelen 2018-06-20 12:52:17 +02:00 committed by Frank Morgner
parent f392d7426f
commit 2682741293
1 changed files with 2 additions and 1 deletions

View File

@ -951,12 +951,13 @@ static int cac_get_challenge(sc_card_t *card, u8 *rnd, size_t len)
{
/* CAC requires 8 byte response */
u8 rbuf[8];
u8 *rbufp = &rbuf[0];
size_t out_len = sizeof rbuf;
int r;
LOG_FUNC_CALLED(card->ctx);
r = cac_apdu_io(card, 0x84, 0x00, 0x00, NULL, 0, (u8 **) &rbuf, &out_len);
r = cac_apdu_io(card, 0x84, 0x00, 0x00, NULL, 0, &rbufp, &out_len);
LOG_TEST_RET(card->ctx, r, "Could not get challenge");
if (len < out_len) {