Skip to content

Commit

Permalink
use php_mt_rand_range for 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jul 10, 2024
1 parent 1594986 commit d5a6b4b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
#include "php_ini.h"
#include "php_globals.h"
#include "ext/standard/info.h"
#if PHP_VERSION_ID < 80400
#include "ext/standard/php_rand.h"
#else
#include "ext/random/php_random.h"
#endif
#include "zend_smart_str.h"
#include "php_mcrypt_filter.h"

Expand Down Expand Up @@ -1414,7 +1418,7 @@ PHP_FUNCTION(mcrypt_create_iv)
} else {
n = (int)size;
while (size) {
iv[--size] = (char) (255.0 * php_rand() / RAND_MAX);
iv[--size] = (char)php_mt_rand_range(0, 255);
}
}
RETVAL_STRINGL(iv, n);
Expand Down

0 comments on commit d5a6b4b

Please sign in to comment.