opencryptoki/opencryptoki-3.16.0-covscan.patch

91 lines
3.8 KiB
Diff
Raw Normal View History

diff -up opencryptoki-3.16.0/usr/lib/common/key.c.me opencryptoki-3.16.0/usr/lib/common/key.c
--- opencryptoki-3.16.0/usr/lib/common/key.c.me 2021-06-17 16:51:43.353937929 +0200
+++ opencryptoki-3.16.0/usr/lib/common/key.c 2021-06-17 18:25:58.460154709 +0200
@@ -1621,10 +1621,10 @@ error:
free(never_extr_attr);
if (always_sens_attr)
free(always_sens_attr);
- if (trusted_attr)
+ if (wrap_trusted_attr)
free(wrap_trusted_attr);
if (trusted_attr)
- free(wrap_trusted_attr);
+ free(trusted_attr);
if (chkval_attr)
free(chkval_attr);
if (wraptmpl_attr)
@@ -2318,8 +2318,8 @@ error:
free(type_attr);
if (modulus_attr)
free(modulus_attr);
- if (public_exp_attr)
- free(public_exp_attr);
+ if (private_exp_attr)
+ free(private_exp_attr);
if (public_exp_attr)
free(public_exp_attr);
diff -up opencryptoki-3.16.0/usr/lib/common/mech_aes.c.me opencryptoki-3.16.0/usr/lib/common/mech_aes.c
--- opencryptoki-3.16.0/usr/lib/common/mech_aes.c.me 2021-06-17 18:24:18.502746362 +0200
+++ opencryptoki-3.16.0/usr/lib/common/mech_aes.c 2021-06-17 18:24:50.840201978 +0200
@@ -3440,6 +3440,7 @@ CK_RV ckm_aes_key_gen(STDLL_TokData_t *t
else
memcpy(value_attr->pValue, aes_key, key_size);
free(aes_key);
+ aes_key = NULL;
key_type_attr->type = CKA_KEY_TYPE;
key_type_attr->ulValueLen = sizeof(CK_KEY_TYPE);
diff -up opencryptoki-3.16.0/usr/lib/common/mech_des3.c.me opencryptoki-3.16.0/usr/lib/common/mech_des3.c
--- opencryptoki-3.16.0/usr/lib/common/mech_des3.c.me 2021-06-17 18:20:48.851711819 +0200
+++ opencryptoki-3.16.0/usr/lib/common/mech_des3.c 2021-06-17 18:22:59.953601204 +0200
@@ -2776,6 +2776,7 @@ CK_RV ckm_des3_key_gen(STDLL_TokData_t *
else
memcpy(value_attr->pValue, des_key, 3 * DES_KEY_SIZE);
free(des_key);
+ des_key = NULL;
key_type_attr->type = CKA_KEY_TYPE;
key_type_attr->ulValueLen = sizeof(CK_KEY_TYPE);
diff -up opencryptoki-3.16.0/usr/lib/common/mech_des.c.me opencryptoki-3.16.0/usr/lib/common/mech_des.c
--- opencryptoki-3.16.0/usr/lib/common/mech_des.c.me 2021-06-17 18:23:12.251782646 +0200
+++ opencryptoki-3.16.0/usr/lib/common/mech_des.c 2021-06-17 18:23:42.388227257 +0200
@@ -1288,6 +1288,7 @@ CK_RV ckm_des_key_gen(STDLL_TokData_t *t
else
memcpy(value_attr->pValue, des_key, DES_KEY_SIZE);
free(des_key);
+ des_key = NULL;
key_type_attr->type = CKA_KEY_TYPE;
key_type_attr->ulValueLen = sizeof(CK_KEY_TYPE);
diff -up opencryptoki-3.16.0/usr/lib/soft_stdll/soft_specific.c.me opencryptoki-3.16.0/usr/lib/soft_stdll/soft_specific.c
diff -up opencryptoki-3.16.0/usr/sbin/pkcsslotd/socket_server.c.me opencryptoki-3.16.0/usr/sbin/pkcsslotd/socket_server.c
--- opencryptoki-3.16.0/usr/sbin/pkcsslotd/socket_server.c.me 2021-06-17 15:23:53.205373200 +0200
+++ opencryptoki-3.16.0/usr/sbin/pkcsslotd/socket_server.c 2021-06-17 18:20:25.490376922 +0200
@@ -625,7 +625,6 @@ static void event_delivered(struct event
rc = admin_event_delivered(conn, event);
if (rc != 0) {
admin_hangup(conn);
- event_free(event);
}
admin_put(conn);
} else {
@@ -1247,7 +1246,7 @@ static int listener_socket_create(const
memset(&address, 0, sizeof(struct sockaddr_un));
address.sun_family = AF_UNIX;
- strcpy(address.sun_path, file_path);
+ snprintf(address.sun_path, sizeof(address.sun_path), "%s", file_path);
if (bind(listener_socket,
(struct sockaddr *) &address, sizeof(struct sockaddr_un)) != 0) {
@@ -1656,7 +1655,7 @@ int init_socket_data(Slot_Mgr_Socket_t *
int socket_connection_handler(int timeout_secs)
{
struct epoll_event events[MAX_EPOLL_EVENTS];
- int num_events, i, rc, err;
+ int num_events, i, rc = 0, err;
struct epoll_info *info;
do {