mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
MFB: fix #40999 (mcrypt_create_iv() not using random seed)
This commit is contained in:
parent
8bb69d5e0d
commit
5f0b474146
@ -35,6 +35,7 @@
|
||||
#include "php_ini.h"
|
||||
#include "php_globals.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "ext/standard/php_rand.h"
|
||||
|
||||
static int le_mcrypt;
|
||||
|
||||
@ -1039,8 +1040,7 @@ int php_mcrypt_iv(php_mcrypt_iv_source source, int size, char **iv_str, int *iv_
|
||||
case PHP_MCRYPT_IV_SOURCE_RAND:
|
||||
*iv_len = size;
|
||||
while (size) {
|
||||
unsigned int ctx;
|
||||
(*iv_str)[--size] = 255.0 * php_rand_r(&ctx) / RAND_MAX;
|
||||
(*iv_str)[--size] = 255.0 * php_rand(TSRMLS_C) / RAND_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user