lua-bcrypt

Secure password hashing for Lua
Log | Files | Refs

commit cfe2b19f3de1c594045f225f7628aeec19c5e062
parent 1999356b63942833c0a550d34f33704cba49aa11
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon,  5 May 2014 14:22:12 +0100

Don't leak fds if open_random fails

Diffstat:
src/main.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -54,11 +54,15 @@ static int open_random( const char * const path ) { struct stat stat_buf; if( fd == -1 || fstat( fd, &stat_buf ) != 0 ) { + ( void ) fclose( f ); + return BC_ERR_API; } // is this a random device? if( S_ISCHR( stat_buf.st_mode ) != 0 && stat_buf.st_rdev != makedev( 1, 8 ) && stat_buf.st_rdev != makedev( 1, 9 ) ) { + ( void ) fclose( f ); + return BC_ERR_RNG; }