summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index a6d709aaed..d9fe5506bc 100644
--- a/thread.c
+++ b/thread.c
@@ -2465,7 +2465,9 @@ rb_fd_rcopy(fd_set *dst, rb_fdset_t *src)
{
int max = rb_fd_max(src);
- if (max > FD_SETSIZE) {
+ /* we assume src is the result of select() with dst, so dst should be
+ * larger or equal than src. */
+ if (max > FD_SETSIZE || max > dst->fd_count) {
rb_raise(rb_eArgError, "too large fdsets");
}