Browse Source

Merge branch 'PHP-7.2'

* PHP-7.2:
  Fix bug #75409
pull/2930/head
krakjoe 8 years ago
parent
commit
192a77787c
No known key found for this signature in database GPG Key ID: F9BA0ADA31CBD89E
  1. 2
      NEWS
  2. 12
      ext/standard/random.c

2
NEWS

@ -130,6 +130,8 @@ PHP NEWS
- Standard:
. Fixed unzserialize(), to disable creation of unsupported data structures
through manually crafted strings. (Dmitry)
. Fixed bug #75409 (accept EFAULT in addition to ENOSYS as indicator
that getrandom() is missing). (sarciszewski)
- Testing:
. Implemented request #62055 (Make run-tests.php support --CGI-- sections).

12
ext/standard/random.c

@ -122,16 +122,10 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
} else if (errno == EINTR || errno == EAGAIN) {
/* Try again */
continue;
} else {
/* If the syscall fails, fall back to reading from /dev/urandom */
break;
}
/*
If the syscall fails, we are doomed. The loop that calls
php_random_bytes should be terminated by the exception instead
of proceeding to demand more entropy.
*/
if (should_throw) {
zend_throw_exception(zend_ce_exception, "Could not gather sufficient random data", errno);
}
return FAILURE;
}
read_bytes += (size_t) n;

Loading…
Cancel
Save