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:
Ronald Cron 2020-04-03 15:36:16 +02:00
parent 59f2139df0
commit 1d3eab684c

View file

@ -392,6 +392,9 @@ int main(int argc, const char *argv[])
for( i = 1; i < cnt; i++ )
{
if( dep_check( params[i] ) != DEPENDENCY_SUPPORTED )
{
if( unmet_dep_count <
ARRAY_LENGTH( unmet_dependencies ) )
{
if( 0 != option_verbose )
{
@ -407,6 +410,7 @@ int main(int argc, const char *argv[])
unmet_dep_count++;
}
}
}
if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
break;