mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-29 21:53:03 +00:00
Note that unmet_dependencies is only filled in verbose mode
Warn about a gotcha that caused a bug in development. Ensure that it's at least zeroed out, rather than uninitialized, in non-verbose mode. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f3037ec2da
commit
67665509ab
|
@ -348,7 +348,7 @@ int main(int argc, const char *argv[])
|
||||||
testfile_index++ )
|
testfile_index++ )
|
||||||
{
|
{
|
||||||
int unmet_dep_count = 0;
|
int unmet_dep_count = 0;
|
||||||
char *unmet_dependencies[20];
|
char *unmet_dependencies[20]; /* only filled when verbose != 0 */
|
||||||
|
|
||||||
test_filename = test_files[ testfile_index ];
|
test_filename = test_files[ testfile_index ];
|
||||||
|
|
||||||
|
@ -369,6 +369,7 @@ int main(int argc, const char *argv[])
|
||||||
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
unmet_dep_count = 0;
|
unmet_dep_count = 0;
|
||||||
|
memset( unmet_dependencies, 0, sizeof( unmet_dependencies ) );
|
||||||
|
|
||||||
if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
|
if( ( ret = get_line( file, buf, sizeof(buf) ) ) != 0 )
|
||||||
break;
|
break;
|
||||||
|
@ -391,18 +392,16 @@ 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( 0 != option_verbose )
|
||||||
{
|
{
|
||||||
/* Only one count is needed if not verbose */
|
unmet_dependencies[unmet_dep_count] =
|
||||||
unmet_dep_count++;
|
strdup( params[i] );
|
||||||
break;
|
if( unmet_dependencies[unmet_dep_count] == NULL )
|
||||||
}
|
{
|
||||||
|
mbedtls_fprintf( stderr,
|
||||||
unmet_dependencies[ unmet_dep_count ] = strdup(params[i]);
|
"FATAL: Out of memory\n" );
|
||||||
if( unmet_dependencies[ unmet_dep_count ] == NULL )
|
mbedtls_exit( MBEDTLS_EXIT_FAILURE );
|
||||||
{
|
}
|
||||||
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