diff --git a/src/libopensc/card-mcrd.c b/src/libopensc/card-mcrd.c index e041ccbd..2e4e50fa 100644 --- a/src/libopensc/card-mcrd.c +++ b/src/libopensc/card-mcrd.c @@ -963,8 +963,9 @@ mcrd_select_file(sc_card_t * card, const sc_path_t * path, sc_file_t ** file) } else { unsigned short int pathtmp[SC_MAX_PATH_SIZE / 2]; unsigned short int *pathptr; - + int samepath = 1; size_t pathlen, n; + if ((path->len & 1) || path->len > sizeof(pathtmp)) return SC_ERROR_INVALID_ARGUMENTS; @@ -974,8 +975,6 @@ mcrd_select_file(sc_card_t * card, const sc_path_t * path, sc_file_t ** file) (path->value[n] << 8) | path->value[n + 1]; pathlen = path->len >> 1; - int samepath = 1; - if (pathlen == priv->curpathlen && priv->is_ef != 2) { for (n = 0; n < pathlen; n++) { if (priv->curpath[n] != pathptr[n]) { @@ -1038,6 +1037,7 @@ int select_key_df(sc_card_t * card) int r, i; char tmpstr[16] = ""; char currpathpart[10]; + sc_path_t tmppath; struct mcrd_priv_data *priv = DRVDATA(card); memset(tmpstr, 0, 16); i = 0; @@ -1048,7 +1048,6 @@ int select_key_df(sc_card_t * card) i++; } - sc_path_t tmppath; sc_format_path(tmpstr, &tmppath); tmppath.type = SC_PATH_TYPE_PATH; r = sc_select_file(card, &tmppath, NULL); diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index ce5430c1..74ecbb6f 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -2476,10 +2476,10 @@ asn1_sequence_wrapper(const u8 *data, size_t len, CK_ATTRIBUTE_PTR attr) u8 *dest; unsigned int n; size_t len2; + size_t lenb = 1; len2 = len; /* calculate the number of bytes needed for the length */ - size_t lenb = 1; if (len > 127) { unsigned int i; for (i = 0; (len & (0xff << i)) != 0 && (0xff << i) != 0; i++)