[net.mail] Bug in sendmail

gordon@inuxc.UUCP (G Gordon) (11/30/84)

Sendmail seems to have a problem sending mail to MANY people through
the same mailer.  The symptom is that you get errno=14 (EFAULT - The
system encountered a hardware fault in attempting to use an argument
of a system call) when trying to exec the mailer.

On USG 5.0 (and I think System 5 Release 2), the problem is in
deliver.c at approximately line 192.  The line as it exists is:

if (sizeof tobuf - (strlen(to->q_paddr) + strlen(tobuf) + 2) < 0)
	break;

The problem here is that since both sizeof and strlen return
unsigned integers and zero is unsigned, all the arithmetic and
comparisons is done with unsigned arithmetic.  So the comparison
fails and we overwrite a lot of area after tobuf.  It is fixed it by
type casting it all to int.  The following does work (and may be
overkill on the typecasting):

if (((int) sizeof tobuf - (int) (strlen(to->q_paddr) + strlen(tobuf) + 2)) < 0)
	break;

I have tested it and it does fix the problem.

		Glen Gordon
		AT&T/CP - Indy
		inuxc!gordon
		8-338-6066 or 317-845-6066