Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!topaz!hedrick From: hedrick@topaz.RUTGERS.EDU (Charles Hedrick) Newsgroups: net.unix-wizards Subject: Re: Runaway Sendmails Message-ID: <4758@topaz.RUTGERS.EDU> Date: Sun, 13-Apr-86 00:26:30 EST Article-I.D.: topaz.4758 Posted: Sun Apr 13 00:26:30 1986 Date-Received: Sat, 19-Apr-86 04:05:46 EST References: <56@uscvax.UUCP> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 38 We have also seen runaway sendmails. At least one cause is improper error checking in the module collect.c. Here are the things we have found so far. They may be other problems like these, though. 31a32 > extern char *RealHostName; /* 2 host name in err msg */ 76,77c77,80 < for (; !feof(InChannel); !feof(InChannel) && !ferror(InChannel) && < sfgets(buf, MAXFIELD, InChannel) != NULL) --- > /* 3 add ferror to termination condition to prevent infinite loop on error */ > for (; !feof(InChannel) && !ferror(InChannel); > !feof(InChannel) && !ferror(InChannel) && > sfgets(buf, MAXFIELD, InChannel) != NULL) 85c88,90 < while ((c = getc(InChannel)) != '\n') --- > /* 12 avoid infinite loop if error while in loop */ > while (((c = getc(InChannel)) != '\n') && > (c != EOF)) 135,136c140,143 < for (; !feof(InChannel); !feof(InChannel) && !ferror(InChannel) && < sfgets(buf, sizeof buf, InChannel) != NULL) --- > /* 3 add ferror to termination condition to prevent infinite loop on error */ > for (; !feof(InChannel) && !ferror(InChannel); > !feof(InChannel) && !ferror(InChannel) && > sfgets(buf, sizeof buf, InChannel) != NULL) 165a173 > /* 2 add RealHostName to error message to help us track down problems */ 167c175,179 < syserr("collect: unexpected close"); --- > syserr("collect: %s unexpected close",RealHostName); > /* 3 add test for error and syserr if found - part of loop prevention */ > /* An error is always a bad sign */ > if (ferror(InChannel)) > syserr("collect: %s input error",RealHostName);