1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Fix usage of ASSERT_ALLOC()

The second argument is the number of elements of the type the first
argument is pointing to, so we shouldn't be using sizeof there.

This was resulting in overly large allocations.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard
2022-10-14 09:35:55 +02:00
parent 49e4184812
commit 47b8de834d
2 changed files with 2 additions and 2 deletions

View File

@ -779,7 +779,7 @@ void free_named_data_list( int length )
for( i = 0; i < length; i++ )
{
mbedtls_asn1_named_data *new = NULL;
ASSERT_ALLOC( new, sizeof( mbedtls_asn1_named_data ) );
ASSERT_ALLOC( new, 1 );
new->next = head;
head = new;
}

View File

@ -137,7 +137,7 @@ void init_handshake_options( handshake_test_options *opts )
opts->resize_buffers = 1;
#if defined(MBEDTLS_SSL_CACHE_C)
opts->cache = NULL;
ASSERT_ALLOC( opts->cache, sizeof( mbedtls_ssl_cache_context ) );
ASSERT_ALLOC( opts->cache, 1 );
mbedtls_ssl_cache_init( opts->cache );
exit:
return;