From fcfbca19d77899f0252ad26992f876bd96342d66 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Tue, 4 May 2010 08:07:20 +0000 Subject: [PATCH] bugfix: initializing apdu in pace_gen_auth. bin_log now checks input data. git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@88 96b47cad-a561-4643-ad3b-153ac7d7599c --- ccid/pace.c | 4 +--- ccid/sm.c | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ccid/pace.c b/ccid/pace.c index 531af15..8c6cd42 100644 --- a/ccid/pace.c +++ b/ccid/pace.c @@ -401,8 +401,6 @@ static int pace_gen_auth(sc_card_t *card, memset(&apdu, 0, sizeof apdu); apdu.cla = 0x10; apdu.ins = 0x86; - apdu.p1 = 0; - apdu.p2 = 0; apdu.cse = SC_APDU_CASE_4; apdu.flags = SC_APDU_FLAGS_NO_GET_RESP|SC_APDU_FLAGS_NO_RETRY_WL; @@ -583,7 +581,7 @@ pace_reset_retry_counter(struct sm_ctx *ctx, sc_card_t *card, { sc_apdu_t apdu; - apdu.cla = 0; + memset(&apdu, 0, sizeof apdu); apdu.ins = 0x2C; apdu.p2 = pin_id; apdu.data = (u8 *) new; diff --git a/ccid/sm.c b/ccid/sm.c index 2729671..181f1a5 100644 --- a/ccid/sm.c +++ b/ccid/sm.c @@ -49,7 +49,10 @@ void _bin_log(sc_context_t *ctx, int type, const char *file, int line, { char buf[1024]; - sc_hex_dump(ctx, data, len, buf, sizeof buf); + if (data) + sc_hex_dump(ctx, data, len, buf, sizeof buf); + else + buf[0] = 0; if (!f) { sc_do_log(ctx, type, file, line, func, "\n%s (%u byte%s):\n%s"