mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-12 22:05:34 +00:00
unit tests: Fix potential buffer overflow
Fix potential buffer overflow when tracking the unmet dependencies of a test case. The identifiers of unmet dependencies are stored in an array of fixed size. Ensure that we don't overrun the array. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
59f2139df0
commit
1d3eab684c
|
@ -393,18 +393,22 @@ int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if( dep_check( params[i] ) != DEPENDENCY_SUPPORTED )
|
if( dep_check( params[i] ) != DEPENDENCY_SUPPORTED )
|
||||||
{
|
{
|
||||||
if( 0 != option_verbose )
|
if( unmet_dep_count <
|
||||||
|
ARRAY_LENGTH( unmet_dependencies ) )
|
||||||
{
|
{
|
||||||
unmet_dependencies[unmet_dep_count] =
|
if( 0 != option_verbose )
|
||||||
strdup( params[i] );
|
|
||||||
if( unmet_dependencies[unmet_dep_count] == NULL )
|
|
||||||
{
|
{
|
||||||
mbedtls_fprintf( stderr,
|
unmet_dependencies[unmet_dep_count] =
|
||||||
"FATAL: Out of memory\n" );
|
strdup( params[i] );
|
||||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
if( unmet_dependencies[unmet_dep_count] == NULL )
|
||||||
|
{
|
||||||
|
mbedtls_fprintf( stderr,
|
||||||
|
"FATAL: Out of memory\n" );
|
||||||
|
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
unmet_dep_count++;
|
||||||
}
|
}
|
||||||
unmet_dep_count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue