PIV: fix segfault and valgrind issue

prototype of 'get-guid' has been changed;

valgrind issue:
Conditional jump or move depends on uninitialised value(s)
   at 0x5A0159B: vfprintf (vfprintf.c:1629)
   by 0x5AC04BF: __vsnprintf_chk (vsnprintf_chk.c:65)
   by 0x522A665: sc_do_log_va.part.0 (stdio2.h:78)
   by 0x522A819: sc_do_log (log.c:52)
   by 0x529462F: piv_card_ctl (card-piv.c:1794)
   by 0x5232E2F: sc_card_ctl (card.c:772)
   by 0x52E561D: sc_pkcs15emu_piv_init (pkcs15-piv.c:626)
This commit is contained in:
Viktor Tarasov 2014-02-09 13:24:51 +01:00
parent 8000564239
commit 12d362fc73
2 changed files with 7 additions and 4 deletions

View File

@ -1790,10 +1790,11 @@ static int piv_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
piv_private_data_t * priv = PIV_DATA(card);
u8 * opts; /* A or M, key_ref, alg_id */
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,"cmd=%ld ptr=%p");
LOG_FUNC_CALLED(card->ctx);
sc_log(card->ctx, "cmd=%ld ptr=%p", cmd, ptr);
if (priv == NULL) {
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL);
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INTERNAL);
}
switch(cmd) {
case SC_CARDCTL_PIV_AUTHENTICATE:
@ -1824,7 +1825,7 @@ static int piv_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
break;
}
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_NOT_SUPPORTED);
LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED);
}
static int piv_get_challenge(sc_card_t *card, u8 *rnd, size_t len)

View File

@ -610,6 +610,8 @@ static int sc_pkcs15emu_piv_init(sc_pkcs15_card_t *p15card)
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
memset(&serial, 0, sizeof(serial));
/* could read this off card if needed */
/* CSP does not like a - in the name */