Package: atftpd
Version: 0.7.dfsg-1.1

The atftpd deamon does not check the return value of the select on the
inet socket. If for some reason the select fails (interupted system call),
the rfds-bit array is used while the select(3) man page explicitely states
that this set is invalid. This occasionally leads to a flood of processes
spawned, all hanging in a select themselves since there is nothing to read.

A patch to solve this issue is atteched.

Leo.
--- tftpd.c.orig        2007-02-13 07:58:48.000000000 +0100
+++ tftpd.c     2007-02-13 08:01:31.000000000 +0100
@@ -390,10 +390,18 @@
              packets */
           if (!tftpd_cancel)
           {
+               int rv;
+
                if ((tftpd_timeout == 0) || (tftpd_daemon))
-                    select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
+                    rv = select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
                else
-                    select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
+                    rv = select(FD_SETSIZE, &rfds, NULL, NULL, &tv);
+               if (rv < 0) {
+                    logger(LOG_ERR, "%s: %d: select: %s",
+                           __FILE__, __LINE__, strerror(errno));
+                    /* Clear the bits, they are undefined! */
+                    FD_ZERO(&rfds);
+                                       }
           }
 
 #ifdef RATE_CONTROL

Attachment: signature.asc
Description: Digital signature

Reply via email to