More memcpy.
This commit is contained in:
+4
-4
@@ -29,16 +29,16 @@ CK_RV parse_readers(ykpiv_state *state, const CK_BYTE_PTR readers, const CK_ULON
|
|||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
if (readers[i] == '\0' && i != len - 1) {
|
if (readers[i] == '\0' && i != len - 1) {
|
||||||
slots[*n_slots].vid = get_vendor_id(p);
|
slots[*n_slots].vid = get_vendor_id((char *)p);
|
||||||
|
|
||||||
if (slots[*n_slots].vid == UNKNOWN) { // TODO: distinguish between tokenless and unsupported?
|
if (slots[*n_slots].vid == UNKNOWN) { // TODO: distinguish between tokenless and unsupported?
|
||||||
// Unknown slot, just save what info we have
|
// Unknown slot, just save what info we have
|
||||||
memset(&slots[*n_slots].info, 0, sizeof(CK_SLOT_INFO));
|
memset(&slots[*n_slots].info, 0, sizeof(CK_SLOT_INFO));
|
||||||
memset(slots[*n_slots].info.slotDescription, ' ', sizeof(slots[*n_slots].info.slotDescription));
|
memset(slots[*n_slots].info.slotDescription, ' ', sizeof(slots[*n_slots].info.slotDescription));
|
||||||
if (strlen(p) <= sizeof(slots[*n_slots].info.slotDescription))
|
if (strlen((char *)p) <= sizeof(slots[*n_slots].info.slotDescription))
|
||||||
strncpy(slots[*n_slots].info.slotDescription, p, strlen(p));
|
memcpy(slots[*n_slots].info.slotDescription, p, strlen((char *)p));
|
||||||
else
|
else
|
||||||
strncpy(slots[*n_slots].info.slotDescription, p, sizeof(slots[*n_slots].info.slotDescription));
|
memcpy(slots[*n_slots].info.slotDescription, p, sizeof(slots[*n_slots].info.slotDescription));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Supported slot
|
// Supported slot
|
||||||
|
|||||||
Reference in New Issue
Block a user