]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
Don't leak ppp_fd to scripts. Bug reported by Alexander Bergolth.
[ppp.git] / pppd / sys-linux.c
index bf6db3285a81a9a6cebe728476e600ea71dee3f7..099db535357fb8211928fd545143a4e2d68e1476 100644 (file)
@@ -485,6 +485,7 @@ int generic_establish_ppp (int fd)
            error("Couldn't reopen /dev/ppp: %m");
            goto err;
        }
+       (void) fcntl(fd, F_SETFD, FD_CLOEXEC);
        if (ioctl(fd, PPPIOCATTCHAN, &chindex) < 0) {
            error("Couldn't attach to channel %d: %m", chindex);
            goto err_close;
@@ -1050,6 +1051,8 @@ void wait_input(struct timeval *timo)
  */
 void add_fd(int fd)
 {
+    if (fd >= FD_SETSIZE)
+       fatal("internal error: file descriptor too large (%d)", fd);
     FD_SET(fd, &in_fds);
     if (fd > max_in_fd)
        max_in_fd = fd;