From: Todd C. Miller Date: Wed, 12 Sep 2018 13:02:13 +0000 (-0600) Subject: Fix a crash in the event system's poll() backend introduced with X-Git-Tag: SUDO_1_8_25p1^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c639c965cf8dfb6c6bafc4cd78084660371ef27e;p=sudo Fix a crash in the event system's poll() backend introduced with support for nanosecond timers. Only affects systems without ppoll(). Bug #851 --- 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); }