File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,12 +134,19 @@ CK_RV CPKCS11Lib::C_GetSlotList(
134134
135135 CK_ULONG i;
136136 slotList.clear ();
137- CK_SLOT_ID ck_slotList[1024 ];
138- CK_ULONG ulSlotCount = sizeof (ck_slotList)/sizeof (ck_slotList[0 ]);
139- rv = m_pFunc->C_GetSlotList (tokenPresent, ck_slotList, &ulSlotCount);
137+ CK_ULONG ulSlotCount;
138+ rv = m_pFunc->C_GetSlotList (tokenPresent, NULL , &ulSlotCount);
140139 if (CKR_OK == rv)
141- for (i=0 ; i<ulSlotCount; i++)
142- slotList.push_back (ck_slotList[i]);
140+ {
141+ CK_SLOT_ID_PTR ck_slotList;
142+ ck_slotList = (CK_SLOT_ID_PTR)malloc (ulSlotCount * sizeof (CK_SLOT_ID));
143+ rv = m_pFunc->C_GetSlotList (tokenPresent, ck_slotList, &ulSlotCount);
144+ if (CKR_OK == rv)
145+ for (i=0 ; i<ulSlotCount; i++)
146+ slotList.push_back (ck_slotList[i]);
147+
148+ free (ck_slotList);
149+ }
143150
144151 CPKCS11LIB_EPILOGUE;
145152 return rv;
You can’t perform that action at this time.
0 commit comments