From 22728dc5e335af5370594f11ecfdae438ca79827 Mon Sep 17 00:00:00 2001 From: Max Fillinger Date: Thu, 14 Nov 2024 20:41:03 +0100 Subject: [PATCH] Use mbedtls_calloc, not regular calloc Also fix the allocation size. Signed-off-by: Max Fillinger --- programs/ssl/ssl_client2.c | 2 +- programs/ssl/ssl_server2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c index 9b69b170bc..8fea581b16 100644 --- a/programs/ssl/ssl_client2.c +++ b/programs/ssl/ssl_client2.c @@ -2508,7 +2508,7 @@ usage: #if defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) if (opt.exp_label != NULL && opt.exp_len > 0) { - unsigned char *exported_key = calloc((size_t) opt.exp_len, sizeof(unsigned int)); + unsigned char *exported_key = mbedtls_calloc((size_t) opt.exp_len, sizeof(unsigned char)); if (exported_key == NULL) { mbedtls_printf("Could not allocate %d bytes\n", opt.exp_len); ret = 3; diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c index a0a3a68009..3c9fb7e2e0 100644 --- a/programs/ssl/ssl_server2.c +++ b/programs/ssl/ssl_server2.c @@ -3628,7 +3628,7 @@ handshake: #if defined(MBEDTLS_SSL_KEYING_MATERIAL_EXPORT) if (opt.exp_label != NULL && opt.exp_len > 0) { - unsigned char *exported_key = calloc((size_t) opt.exp_len, sizeof(unsigned int)); + unsigned char *exported_key = mbedtls_calloc((size_t) opt.exp_len, sizeof(unsigned char)); if (exported_key == NULL) { mbedtls_printf("Could not allocate %d bytes\n", opt.exp_len); ret = 3;