From c639c965cf8dfb6c6bafc4cd78084660371ef27e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 12 Sep 2018 07:02:13 -0600 Subject: [PATCH] Fix a crash in the event system's poll() backend introduced with support for nanosecond timers. Only affects systems without ppoll(). Bug #851 --- lib/util/event_poll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/event_poll.c b/lib/util/event_poll.c index c717b79da..c21d1ca8b 100644 --- a/lib/util/event_poll.c +++ b/lib/util/event_poll.c @@ -144,7 +144,8 @@ sudo_ev_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timo) static int sudo_ev_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timo) { - const int timeout = (timo->tv_sec * 1000) + (timo->tv_nsec / 1000000); + const int timeout = + timo ? (timo->tv_sec * 1000) + (timo->tv_nsec / 1000000) : -1; return poll(fds, nfds, timeout); } -- 2.40.0