From 72a5137e9d69e9d8381f21031d87eef3c1039078 Mon Sep 17 00:00:00 2001 From: Alessio Di Mauro Date: Fri, 27 Nov 2015 15:43:24 +0100 Subject: [PATCH] More memcpy. --- ykcs11/utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ykcs11/utils.c b/ykcs11/utils.c index 6cc729b..11968eb 100644 --- a/ykcs11/utils.c +++ b/ykcs11/utils.c @@ -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++) 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? // Unknown slot, just save what info we have memset(&slots[*n_slots].info, 0, sizeof(CK_SLOT_INFO)); memset(slots[*n_slots].info.slotDescription, ' ', sizeof(slots[*n_slots].info.slotDescription)); - if (strlen(p) <= sizeof(slots[*n_slots].info.slotDescription)) - strncpy(slots[*n_slots].info.slotDescription, p, strlen(p)); + if (strlen((char *)p) <= sizeof(slots[*n_slots].info.slotDescription)) + memcpy(slots[*n_slots].info.slotDescription, p, strlen((char *)p)); 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 { // Supported slot