]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/tty.c
Make sure we don't do FD_SET(fd, set) with fd >= FD_SETSIZE since
[ppp.git] / pppd / tty.c
index 803d8ba02edecad13d30d4cc38517d7731b4f56a..efc92ec0fd34cbf8da3304c02db6ae70f8aa20e1 100644 (file)
@@ -73,7 +73,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: tty.c,v 1.8 2002/12/04 23:03:33 paulus Exp $"
+#define RCSID  "$Id: tty.c,v 1.9 2002/12/06 12:06:45 paulus Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -992,6 +992,13 @@ charshunt(ifd, ofd, record_file)
     signal(SIGXFSZ, SIG_DFL);
 #endif
 
+    /*
+     * Check that the fds won't overrun the fd_sets
+     */
+    if (ifd >= FD_SETSIZE || ofd >= FD_SETSIZE || pty_master >= FD_SETSIZE)
+       fatal("internal error: file descriptor too large (%d, %d, %d)",
+             ifd, ofd, pty_master);
+
     /*
      * Open the record file if required.
      */