mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-26 23:14:07 +08:00
Check for buffer overflow in test function
This commit is contained in:
parent
08f06eb049
commit
9c16ede466
@ -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 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user