]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sched: check that added file descriptor fits in fd_set
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 15 Aug 2014 14:36:00 +0000 (16:36 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 15 Aug 2014 14:52:37 +0000 (16:52 +0200)
sched.c

diff --git a/sched.c b/sched.c
index 80d68fdf53875215a14534657eca40b0854c104d..81b58f71de77a9802b69c575188a5e247d0c8341 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -169,6 +169,9 @@ SCH_AddInputFileHandler
 
   assert(initialised);
   
+  if (fd >= FD_SETSIZE)
+    LOG_FATAL(LOGF_Scheduler, "Too many file descriptors");
+
   /* Don't want to allow the same fd to register a handler more than
      once without deleting a previous association - this suggests
      a bug somewhere else in the program. */