[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 72dc465 2/4: * src/nsterm.m (ns_select): Fix off-by-one error, an
From: |
Philipp Stephani |
Subject: |
master 72dc465 2/4: * src/nsterm.m (ns_select): Fix off-by-one error, and add assertion |
Date: |
Wed, 30 Dec 2020 17:08:56 -0500 (EST) |
branch: master
commit 72dc46584cec3652c910b7c414e83353a5b536e9
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>
* src/nsterm.m (ns_select): Fix off-by-one error, and add assertion
---
src/nsterm.m | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index 1616774..1a23fc6 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;