mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-10-19 15:17:57 +00:00
Check for buffer overflow in test function
This commit is contained in:
@@ -123,6 +123,7 @@ void pk_parse_key( char *key_data, int result )
|
|||||||
mbedtls_pk_init( &pk );
|
mbedtls_pk_init( &pk );
|
||||||
|
|
||||||
memset( buf, 0, sizeof( buf ) );
|
memset( buf, 0, sizeof( buf ) );
|
||||||
|
TEST_ASSERT( strlen( key_data ) / 2 <= sizeof( buf ) );
|
||||||
data_len = unhexify( buf, key_data );
|
data_len = unhexify( buf, key_data );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf, data_len, NULL, 0 ) == result );
|
TEST_ASSERT( mbedtls_pk_parse_key( &pk, buf, data_len, NULL, 0 ) == result );
|
||||||
|
|||||||
Reference in New Issue
Block a user