Merge branch 'release-1.34'

This commit is contained in:
Isaac Connor 2020-03-21 15:28:27 -04:00
commit e06912a995
2 changed files with 16 additions and 1 deletions

View File

@ -2643,4 +2643,19 @@ function random_colour() {
str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT); str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
} }
function zm_random_bytes($length = 32){
if ( !isset($length) || intval($length) <= 8 ) {
$length = 32;
}
if ( function_exists('random_bytes') ) {
return random_bytes($length);
}
if ( function_exists('mcrypt_create_iv') ) {
return mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
}
if ( function_exists('openssl_random_pseudo_bytes') ) {
return openssl_random_pseudo_bytes($length);
}
ZM\Error('No random_bytes function found.');
}
?> ?>

View File

@ -178,7 +178,7 @@ if ( isset($_REQUEST['view']) )
# Add CSP Headers # Add CSP Headers
$cspNonce = bin2hex(openssl_random_pseudo_bytes(16)); $cspNonce = bin2hex(zm_random_bytes(16));
$request = null; $request = null;
if ( isset($_REQUEST['request']) ) if ( isset($_REQUEST['request']) )