summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <scott@paragonie.com>2015-10-21 16:04:34 -0400
committerAnatol Belski <ab@php.net>2015-12-08 13:16:48 +0100
commitc0ce2281bcb8f4a9f43eaf0d54cee2eb990dd031 (patch)
treeec5eafe838b866a540323705ca7763a9d511245e
parent908f67b1d44521aaac61e725290f3dc8a3fddcc7 (diff)
downloadphp-git-c0ce2281bcb8f4a9f43eaf0d54cee2eb990dd031.tar.gz
Update random.c
Supersedes #1589
-rw-r--r--ext/standard/random.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 5fbb460184..7dbc379459 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -102,7 +102,6 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
/* Keep reading until we get enough entropy */
do {
- amount_to_read = size - read_bytes;
/* Below, (bytes + read_bytes) is pointer arithmetic.
bytes read_bytes size
@@ -112,6 +111,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
amount_to_read
*/
+ amount_to_read = size - read_bytes;
n = syscall(SYS_getrandom, bytes + read_bytes, amount_to_read, 0);
if (n == -1) {