]> granicus.if.org Git - sudo/commitdiff
Fix a crash in the event system's poll() backend introduced with
authorTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 12 Sep 2018 13:02:13 +0000 (07:02 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Wed, 12 Sep 2018 13:02:13 +0000 (07:02 -0600)
support for nanosecond timers.  Only affects systems without ppoll().
Bug #851

lib/util/event_poll.c

index c717b79da460dfabf2b7125bee9f9fea0922372b..c21d1ca8bc83def28a3092d83a0ab6e8f91078e5 100644 (file)
@@ -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);
 }