Here is the output of the pkcs11-global.c problem:
cl /D_CRT_SECURE_NO_DEPRECATE /Zi /MD /nologo /DHAVE_CONFIG_H /I..\..\sr
c\include /I..\..\src\include\opensc /I..\..\src\common /I"x:\appl\OpenSSL-0.9.8
d\win32\include" /I"C:\opt\zlib123-dll\include" /I"D:\opt\OpenSC\GnuWin32\includ
e" /D_WIN32_WINNT=0x0400 /DENABLE_OPENSSL /DENABLE_ZLIB /c pkcs11-global.c pkcs1
1-session.c pkcs11-object.c misc.c slot.c mechanism.c openssl.c secretkey.c fram
ework-pkcs15.c framework-pkcs15init.c debug.c hack-enabled.c
pkcs11-global.c
pkcs11-global.c(323) : error C2057: expected constant expression
pkcs11-global.c(323) : error C2466: cannot allocate an array of constant size 0
pkcs11-global.c(323) : error C2133: 'found' : unknown size
Line 323 is:
CK_SLOT_ID found[sc_pkcs11_conf.pkcs11_max_virtual_slots];
Attached is a suggested fix.
--
Douglas E. Engert <[EMAIL PROTECTED]>
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444
Index: pkcs11-global.c
===================================================================
--- pkcs11-global.c (revision 3458)
+++ pkcs11-global.c (working copy)
@@ -320,7 +320,7 @@
CK_SLOT_ID_PTR pSlotList, /* receives the array of slot
IDs */
CK_ULONG_PTR pulCount) /* receives the number of
slots */
{
- CK_SLOT_ID found[sc_pkcs11_conf.pkcs11_max_virtual_slots];
+ CK_SLOT_ID_PTR found = NULL;
int i;
CK_ULONG numMatches;
sc_pkcs11_slot_t *slot;
@@ -330,6 +330,14 @@
if (rv != CKR_OK)
return rv;
+ if (!(found = (CK_SLOT_ID_PTR)
+ calloc(sc_pkcs11_conf.pkcs11_max_virtual_slots,
+ sizeof(CK_SLOT_ID)))) {
+ rv = SC_ERROR_OUT_OF_MEMORY;
+ goto out;
+ }
+
+
if (pulCount == NULL_PTR) {
rv = CKR_ARGUMENTS_BAD;
goto out;
@@ -367,6 +375,9 @@
sc_debug(context, "returned %d slots\n", numMatches);
out: sc_pkcs11_unlock();
+ if (found) {
+ free(found);
+ }
return rv;
}
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel