mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-09 03:05:33 +00:00
Fixed potential file descriptor leaks
This commit is contained in:
parent
f65fbee52b
commit
88a2264def
|
@ -6,6 +6,7 @@ Changes
|
|||
|
||||
Bugfix
|
||||
* Fixed potential memory leak when failing to resume a session
|
||||
* Fixed potential file descriptor leaks (found by Remi Gacogne)
|
||||
* Minor fixes
|
||||
|
||||
Security
|
||||
|
|
|
@ -356,7 +356,10 @@ int ctr_drbg_write_seed_file( ctr_drbg_context *ctx, const char *path )
|
|||
return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR );
|
||||
|
||||
if( ( ret = ctr_drbg_random( ctx, buf, CTR_DRBG_MAX_INPUT ) ) != 0 )
|
||||
{
|
||||
fclose( f );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
if( fwrite( buf, 1, CTR_DRBG_MAX_INPUT, f ) != CTR_DRBG_MAX_INPUT )
|
||||
{
|
||||
|
@ -382,7 +385,10 @@ int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path )
|
|||
fseek( f, 0, SEEK_SET );
|
||||
|
||||
if( n > CTR_DRBG_MAX_INPUT )
|
||||
{
|
||||
fclose( f );
|
||||
return( POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
||||
}
|
||||
|
||||
if( fread( buf, 1, n, f ) != n )
|
||||
{
|
||||
|
|
|
@ -1967,7 +1967,10 @@ cleanup:
|
|||
i = stat( entry_name, &sb );
|
||||
|
||||
if( i == -1 )
|
||||
{
|
||||
closedir( dir );
|
||||
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
|
||||
}
|
||||
|
||||
if( !S_ISREG( sb.st_mode ) )
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue