mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 05:55:27 +00:00
Add non-regression test for buffer overflow
This commit is contained in:
parent
a277d4cc82
commit
f56da14408
|
@ -19,6 +19,9 @@ mpi_read_write_string:16:"-20":10:"-32":100:0:0
|
|||
Base test mpi_read_write_string #3 (Negative decimal)
|
||||
mpi_read_write_string:16:"-23":16:"-23":100:0:0
|
||||
|
||||
Base test mpi_read_write_string #4 (Buffer just fits)
|
||||
mpi_read_write_string:16:"-4":4:"-10":4:0:0
|
||||
|
||||
Test mpi_read_write_string #1 (Invalid character)
|
||||
mpi_read_write_string:10:"a28":0:"":100:MBEDTLS_ERR_MPI_INVALID_CHARACTER:0
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ void mpi_read_write_string( int radix_X, char *input_X, int radix_A,
|
|||
|
||||
mbedtls_mpi_init( &X );
|
||||
|
||||
memset( str, '!', sizeof( str ) );
|
||||
|
||||
TEST_ASSERT( mbedtls_mpi_read_string( &X, radix_X, input_X ) == result_read );
|
||||
if( result_read == 0 )
|
||||
{
|
||||
|
@ -88,6 +90,7 @@ void mpi_read_write_string( int radix_X, char *input_X, int radix_A,
|
|||
if( result_write == 0 )
|
||||
{
|
||||
TEST_ASSERT( strcasecmp( str, input_A ) == 0 );
|
||||
TEST_ASSERT( str[len] == '!' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue