From 8bb7b592d6458df9e0725318261ecc7c53fbd116 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Sat, 5 Feb 2011 22:06:07 +0000 Subject: [PATCH] avoiding problems due to uninitialized values git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@407 96b47cad-a561-4643-ad3b-153ac7d7599c --- npa/src/npa.c | 3 ++- npa/src/sm.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/npa/src/npa.c b/npa/src/npa.c index 5fe3614..1d68a23 100644 --- a/npa/src/npa.c +++ b/npa/src/npa.c @@ -305,12 +305,13 @@ static int npa_mse_set_at(struct sm_ctx *oldnpactx, sc_card_t *card, NPA_MSE_SET_AT_C *data = NULL; int r, tries; + memset(&apdu, 0, sizeof apdu); + if (!sw1 || !sw2) { r = SC_ERROR_INVALID_ARGUMENTS; goto err; } - memset(&apdu, 0, sizeof apdu); apdu.ins = 0x22; apdu.p1 = 0xc1; apdu.p2 = 0xa4; diff --git a/npa/src/sm.c b/npa/src/sm.c index e723ec4..d04a4c0 100644 --- a/npa/src/sm.c +++ b/npa/src/sm.c @@ -196,7 +196,7 @@ static int format_data(sc_card_t *card, const struct sm_ctx *ctx, { int r; u8 *pad_data = NULL; - size_t pad_data_len; + size_t pad_data_len = 0; if (!ctx || !formatted_data || !formatted_data_len) { r = SC_ERROR_INVALID_ARGUMENTS;