mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 05:41:46 +08:00
rand_unix.c: Ensure requests to KERN_ARND don't exceed 256 bytes.
Requests for more than 256 bytes will fail. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11689)
This commit is contained in:
parent
0c27ce7322
commit
7421f08500
@ -250,7 +250,7 @@ static ssize_t sysctl_random(char *buf, size_t buflen)
|
||||
mib[1] = KERN_ARND;
|
||||
|
||||
do {
|
||||
len = buflen;
|
||||
len = buflen > 256 ? 256 : buflen;
|
||||
if (sysctl(mib, 2, buf, &len, NULL, 0) == -1)
|
||||
return done > 0 ? done : -1;
|
||||
done += len;
|
||||
|
Loading…
Reference in New Issue
Block a user