mirror of
https://github.com/nmap/nmap.git
synced 2026-05-13 16:57:06 +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:
parent
0188383036
commit
59451640d1
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue