diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-09-27 11:11:18 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-10-10 04:06:37 -0700 |
commit | 8c1776ee0781b49e0966d8394f02f55a90d73eba (patch) | |
tree | 64f121b56bbdcad5dd36f3b36bbdcac05ae49fc8 /src/corelib/kernel | |
parent | f003e25258e0fd546abe5857f20b626f160beb81 (diff) |
qpoll: disallow file descriptors bigger than FD_SETSIZE
I don't know which platforms qpoll.cpp is still used and if in those
there's even a way to increase the file descriptor limit above
FD_SETSIZE's. But this is an easy change and protects against buffer
overruns.
Pick-to: 6.4
Change-Id: I810d70e579eb4e2c8e45fffd1718ca1aac8e6bef
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qpoll.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qpoll.cpp b/src/corelib/kernel/qpoll.cpp index eba5664f4a..bbd197f292 100644 --- a/src/corelib/kernel/qpoll.cpp +++ b/src/corelib/kernel/qpoll.cpp @@ -156,6 +156,11 @@ int qt_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout_ts) if (fds[i].fd < 0) continue; + if (fds[i].fd > FD_SETSIZE) { + errno = EINVAL; + return -1; + } + if (fds[i].events & QT_POLL_EVENTS_MASK) continue; |