Fix all clang scan-build warnings
This commit is contained in:
@@ -173,7 +173,7 @@ CK_RV do_create_empty_cert(CK_BYTE_PTR in, CK_ULONG in_len, CK_BBOOL is_rsa,
|
||||
|
||||
// Manually set a signature (same reason as before)
|
||||
ASN1_BIT_STRING_set_bit(cert->signature, 8, 1);
|
||||
ASN1_BIT_STRING_set(cert->signature, "\x00", 1);
|
||||
ASN1_BIT_STRING_set(cert->signature, (unsigned char*)"\x00", 1);
|
||||
|
||||
len = i2d_X509(cert, NULL);
|
||||
if (len < 0)
|
||||
|
||||
@@ -258,8 +258,6 @@ void strip_DER_encoding_from_ECSIG(CK_BYTE_PTR data, CK_ULONG_PTR len) {
|
||||
|
||||
data_ptr++;
|
||||
memcpy(buf_ptr, data_ptr, elem_len);
|
||||
data_ptr += elem_len;
|
||||
buf_ptr += elem_len;
|
||||
|
||||
*len = sig_halflen * 2;
|
||||
memcpy(data, buf, *len);
|
||||
|
||||
@@ -215,6 +215,11 @@ CK_DEFINE_FUNCTION(CK_RV, C_GetSlotList)(
|
||||
return CKR_OK;
|
||||
}
|
||||
|
||||
if (!pulCount) {
|
||||
DOUT;
|
||||
return CKR_ARGUMENTS_BAD;
|
||||
}
|
||||
|
||||
if ((tokenPresent && *pulCount < n_slots_with_token) || (!tokenPresent && *pulCount < n_slots)) {
|
||||
DBG("Buffer too small: needed %lu, provided %lu", n_slots, *pulCount);
|
||||
return CKR_BUFFER_TOO_SMALL;
|
||||
@@ -1214,6 +1219,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_DestroyObject)(
|
||||
|
||||
rv = delete_cert(cert_id);
|
||||
if (rv != CKR_OK) {
|
||||
free(obj_ptr);
|
||||
DBG("Unable to delete certificate data");
|
||||
return CKR_FUNCTION_FAILED;
|
||||
}
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
#include "pkcs11.h"
|
||||
#include <string.h>
|
||||
|
||||
static const CK_UTF8CHAR_PTR slot_manufacturer = "Yubico";
|
||||
static const CK_UTF8CHAR_PTR slot_manufacturer = (const CK_UTF8CHAR_PTR)"Yubico";
|
||||
static const CK_FLAGS slot_flags = CKF_TOKEN_PRESENT | CKF_HW_SLOT;
|
||||
static const CK_VERSION slot_version = {1, 0};
|
||||
|
||||
CK_RV YUBICO_get_slot_manufacturer(CK_UTF8CHAR_PTR str, CK_ULONG len) {
|
||||
|
||||
if (strlen(slot_manufacturer) > len)
|
||||
if (strlen((const char*)slot_manufacturer) > len)
|
||||
return CKR_BUFFER_TOO_SMALL;
|
||||
|
||||
memcpy(str, slot_manufacturer, strlen(slot_manufacturer));
|
||||
memcpy(str, slot_manufacturer, strlen((const char*)slot_manufacturer));
|
||||
return CKR_OK;
|
||||
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ CK_RV YUBICO_token_change_pin(ykpiv_state *state, CK_USER_TYPE user_type, CK_UTF
|
||||
DBG("TODO implement other users pin change");
|
||||
return CKR_FUNCTION_FAILED;
|
||||
}
|
||||
res = ykpiv_change_pin(state, pOldPin, ulOldLen, pNewPin, ulNewLen, &tries);
|
||||
res = ykpiv_change_pin(state, (const char*)pOldPin, ulOldLen, (const char*)pNewPin, ulNewLen, &tries);
|
||||
switch (res) {
|
||||
case YKPIV_OK:
|
||||
return CKR_OK;
|
||||
|
||||
Reference in New Issue
Block a user