mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-07-04 13:08:14 +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
bde4d3045b
commit
69cc630750
|
@ -520,11 +520,15 @@ int execute_tests( int argc , const char ** argv )
|
||||||
{
|
{
|
||||||
int dep_id = strtol( params[i], NULL, 10 );
|
int dep_id = strtol( params[i], NULL, 10 );
|
||||||
if( dep_check( dep_id ) != DEPENDENCY_SUPPORTED )
|
if( dep_check( dep_id ) != DEPENDENCY_SUPPORTED )
|
||||||
|
{
|
||||||
|
if( unmet_dep_count <
|
||||||
|
ARRAY_LENGTH( unmet_dependencies ) )
|
||||||
{
|
{
|
||||||
unmet_dependencies[unmet_dep_count] = dep_id;
|
unmet_dependencies[unmet_dep_count] = dep_id;
|
||||||
unmet_dep_count++;
|
unmet_dep_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( ( ret = get_line( file, buf, sizeof( buf ) ) ) != 0 )
|
if( ( ret = get_line( file, buf, sizeof( buf ) ) ) != 0 )
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue