added compatibility to mingw

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@408 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-02-06 20:26:37 +00:00
parent 8bb7b592d6
commit 3674c41f66
3 changed files with 29 additions and 5 deletions

View File

@@ -907,7 +907,9 @@ npa_reset_retry_counter(struct sm_ctx *ctx, sc_card_t *card,
free(p);
return SC_ERROR_INTERNAL;
}
new_len = strnlen(p, MAX_PIN_LEN+1);
new_len = strlen(p);
if (new_len > MAX_PIN_LEN)
return SC_ERROR_INVALID_PIN_LENGTH;
new = p;
}
@@ -952,7 +954,7 @@ get_psec(sc_card_t *card, const char *pin, size_t length_pin, enum s_type pin_id
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not create password prompt.\n");
return NULL;
}
p = malloc(MAX_MRZ_LEN);
p = malloc(MAX_MRZ_LEN+1);
if (!p) {
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Not enough memory for %s.\n",
npa_secret_name(pin_id));
@@ -963,7 +965,11 @@ get_psec(sc_card_t *card, const char *pin, size_t length_pin, enum s_type pin_id
npa_secret_name(pin_id));
return NULL;
}
length_pin = strnlen(p, MAX_MRZ_LEN);
length_pin = strlen(p);
if (length_pin > MAX_MRZ_LEN) {
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "MRZ too long");
return NULL;
}
pin = p;
}