mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-08 08:15:32 +00:00
Fixed potential file descriptor leaks
This commit is contained in:
parent
3081ba12bb
commit
3513868f29
|
@ -3,6 +3,7 @@ PolarSSL ChangeLog
|
||||||
= Branch 1.1
|
= Branch 1.1
|
||||||
Bugfix
|
Bugfix
|
||||||
* Fixed potential memory leak when failing to resume a session
|
* Fixed potential memory leak when failing to resume a session
|
||||||
|
* Fixed potential file descriptor leaks
|
||||||
|
|
||||||
Security
|
Security
|
||||||
* Potential buffer-overflow for ssl_read_record() (independently found by
|
* Potential buffer-overflow for ssl_read_record() (independently found by
|
||||||
|
|
|
@ -360,7 +360,10 @@ int ctr_drbg_write_seed_file( ctr_drbg_context *ctx, const char *path )
|
||||||
return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR );
|
return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR );
|
||||||
|
|
||||||
if( ( ret = ctr_drbg_random( ctx, buf, CTR_DRBG_MAX_INPUT ) ) != 0 )
|
if( ( ret = ctr_drbg_random( ctx, buf, CTR_DRBG_MAX_INPUT ) ) != 0 )
|
||||||
|
{
|
||||||
|
fclose( f );
|
||||||
return( ret );
|
return( ret );
|
||||||
|
}
|
||||||
|
|
||||||
if( fwrite( buf, 1, CTR_DRBG_MAX_INPUT, f ) != CTR_DRBG_MAX_INPUT )
|
if( fwrite( buf, 1, CTR_DRBG_MAX_INPUT, f ) != CTR_DRBG_MAX_INPUT )
|
||||||
{
|
{
|
||||||
|
@ -386,7 +389,10 @@ int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path )
|
||||||
fseek( f, 0, SEEK_SET );
|
fseek( f, 0, SEEK_SET );
|
||||||
|
|
||||||
if( n > CTR_DRBG_MAX_INPUT )
|
if( n > CTR_DRBG_MAX_INPUT )
|
||||||
|
{
|
||||||
|
fclose( f );
|
||||||
return( POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
return( POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
||||||
|
}
|
||||||
|
|
||||||
if( fread( buf, 1, n, f ) != n )
|
if( fread( buf, 1, n, f ) != n )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue