Merge pull request #616 from mtrojnar/buffer_overflow
Heap-based buffer overflow fix in mutex_create() with PKCS11_THREAD_LOCKING and HAVE_PTHREAD defined
This commit is contained in:
commit
7a2858d7a6
|
@ -46,7 +46,9 @@ extern CK_FUNCTION_LIST pkcs11_function_list;
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
CK_RV mutex_create(void **mutex)
|
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)
|
if (m == NULL)
|
||||||
return CKR_GENERAL_ERROR;;
|
return CKR_GENERAL_ERROR;;
|
||||||
pthread_mutex_init(m, NULL);
|
pthread_mutex_init(m, NULL);
|
||||||
|
|
Loading…
Reference in New Issue