1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Change deprecated RAND_pseudo_bytes call to RAND_bytes

Excellent discussion of the issues with RAND_pseudo_bytes here:
https://jbp.io/2014/01/16/openssl-rand-api/

Essentially, RAND_pseudo_bytes is the same function as RAND_bytes,
except with worse documentation and broken implementations in some
cases.
This commit is contained in:
dmiller
2016-06-26 14:37:21 +00:00
parent 0188383036
commit 59451640d1

View File

@@ -225,7 +225,9 @@ static int l_rand_pseudo_bytes( lua_State *L ) /** rand_pseudo_bytes( number byt
unsigned char * result = (unsigned char *) malloc( len );
if (!result) return luaL_error( L, "Couldn't allocate memory.");
RAND_pseudo_bytes( result, len );
if (RAND_bytes( result, len ) != 1) {
return luaL_error(L, "Failure in RAND_bytes.");
}
lua_pushlstring( L, (char *) result, len );
free( result );
return 1;