PKCS#11: Fix a crash in C_GetMechanismList if pulCount is NULL
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3732 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
a614dff522
commit
831d1a539e
|
@ -80,10 +80,13 @@ sc_pkcs11_get_mechanism_list(struct sc_pkcs11_card *p11card,
|
|||
unsigned int n, count = 0;
|
||||
int rv;
|
||||
|
||||
if (!pulCount)
|
||||
return CKR_ARGUMENTS_BAD;
|
||||
|
||||
for (n = 0; n < p11card->nmechanisms; n++) {
|
||||
if (!(mt = p11card->mechanisms[n]))
|
||||
continue;
|
||||
if (count < *pulCount && pList)
|
||||
if (pList && count < *pulCount)
|
||||
pList[count] = mt->mech;
|
||||
count++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue