From f9e614890da5e514106a8e2ba7c36aff423c444e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Thu, 26 Nov 2015 12:32:47 +0100 Subject: [PATCH] Fix a buffer overflow in thread mutex create --- src/pkcs11/pkcs11-global.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkcs11/pkcs11-global.c b/src/pkcs11/pkcs11-global.c index 275a5bc8..4800c437 100644 --- a/src/pkcs11/pkcs11-global.c +++ b/src/pkcs11/pkcs11-global.c @@ -46,7 +46,9 @@ extern CK_FUNCTION_LIST pkcs11_function_list; #include CK_RV mutex_create(void **mutex) { - pthread_mutex_t *m = calloc(1, sizeof(*mutex)); + pthread_mutex_t *m; + + m = calloc(1, sizeof(*m)); if (m == NULL) return CKR_GENERAL_ERROR;; pthread_mutex_init(m, NULL);