From: Philipp Stephani Date: Wed, 30 Dec 2020 21:17:52 +0000 (+0100) Subject: * src/nsterm.m (ns_select): Fix off-by-one error, and add assertion X-Git-Tag: emacs-28.0.90~4475 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=72dc46584cec3652c910b7c414e83353a5b536e9;p=emacs.git * src/nsterm.m (ns_select): Fix off-by-one error, and add assertion --- diff --git a/src/nsterm.m b/src/nsterm.m index 161677484f9..1a23fc6912c 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4697,7 +4697,8 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, return -1; } - for (k = 0; k < nfds+1; k++) + eassert (nfds <= FD_SETSIZE); + for (k = 0; k < nfds; k++) { if (readfds && FD_ISSET(k, readfds)) ++nr; if (writefds && FD_ISSET(k, writefds)) ++nr;