mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Avoid possible SEGVs in select() (in unit tests)
Per the POSIX definition of select(): http://pubs.opengroup.org/onlinepubs/009696699/functions/pselect.html "Upon successful completion, the select() function may modify the object pointed to by the timout argument." If "struct timeval" pointer is a "static const", it could potentially be allocated in a RO text segment. The kernel would then try to copy back the modified value (with the time remaining) into a read-only address and SEGV. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Closes: #614
This commit is contained in:
parent
4ba4873967
commit
33baa4e59f
@ -141,7 +141,10 @@ evutil_usleep_(const struct timeval *tv)
|
||||
sleep(tv->tv_sec);
|
||||
usleep(tv->tv_usec);
|
||||
#else
|
||||
select(0, NULL, NULL, NULL, tv);
|
||||
{
|
||||
struct timeval tv2 = *tv;
|
||||
select(0, NULL, NULL, NULL, &tv2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user