com php-src: Update random.c: ext/standard/random.c
| From: | Anatol Belski | Date: | Tue, 08 Dec 2015 12:16:48 +0000 |
| Subject: | com php-src: Update random.c: ext/standard/random.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90122@lists.php.net to get a copy of this message | ||
Commit: c0ce2281bcb8f4a9f43eaf0d54cee2eb990dd031
Author: Scott <scott@paragonie.com> Wed, 21 Oct 2015 16:04:34 -0400
Committer: Anatol Belski <ab@php.net> Tue, 8 Dec 2015 13:16:48 +0100
Parents: 908f67b1d44521aaac61e725290f3dc8a3fddcc7
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c0ce2281bcb8f4a9f43eaf0d54cee2eb990dd031
Log:
Update random.c
Supersedes #1589
Bugs:
https://bugs.php.net/1589
Changed paths:
M ext/standard/random.c
Diff:
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 5fbb460..7dbc379 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) {