From: Antony Dovgal Date: Sun, 8 Apr 2007 08:04:30 +0000 (+0000) Subject: MFB: fix #40999 (mcrypt_create_iv() not using random seed) X-Git-Tag: RELEASE_1_1_0~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f0b474146e03cc630852a8d254eede1cc79b4e9;p=php MFB: fix #40999 (mcrypt_create_iv() not using random seed) --- diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 52b114e566..261690ea5f 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -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; }