* Correctly return CKR_PIN_INCORRECT if PIN is out of range.

* By Alon Bar-Lev from svn diff -r 3397:3398 https://www.opensc-project.org/svn/opensc/branches/alonbl/pkcs11-login-rv



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3400 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2008-02-29 10:18:51 +00:00
parent 5a04a103fb
commit 04942bb4f6
1 changed files with 9 additions and 4 deletions

View File

@ -905,10 +905,15 @@ static CK_RV pkcs15_login(struct sc_pkcs11_card *p11card,
* a valid pin (which is processed normally). --okir */
if (ulPinLen == 0)
pPin = NULL;
} else
if (ulPinLen < pin->min_length ||
ulPinLen > pin->max_length)
return CKR_ARGUMENTS_BAD;
} else {
/*
* If PIN is out of range,
* it cannot be correct.
*/
if (ulPinLen < pin->min_length ||
ulPinLen > pin->max_length)
return CKR_PIN_INCORRECT;
}
/* By default, we make the reader resource manager keep other
* processes from accessing the card while we're logged in.