mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Avoid overflowing FDSET when using select(2).
There is a problem in the rand_unix.c code when the random seed fd is greater than or equal to FD_SETSIZE and the FDSET overruns its limit and walks the stack. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/9686)
This commit is contained in:
parent
f42c225d7f
commit
e1f8584d47
@ -390,7 +390,7 @@ static int wait_random_seeded(void)
|
||||
}
|
||||
/* Open /dev/random and wait for it to be readable */
|
||||
if ((fd = open(DEVRANDOM_WAIT, O_RDONLY)) != -1) {
|
||||
if (DEVRANDM_WAIT_USE_SELECT) {
|
||||
if (DEVRANDM_WAIT_USE_SELECT && fd < FD_SETSIZE) {
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
while ((r = select(fd + 1, &fds, NULL, NULL, NULL)) < 0
|
||||
|
Loading…
Reference in New Issue
Block a user