drop ":...;" stuff -- it screws it up aliases; pass parameters to
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 17 Sep 1982 11:25:01 +0000 (03:25 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 17 Sep 1982 11:25:01 +0000 (03:25 -0800)
subroutines (this also adds $@ and $: features to subr calls); check
overflow of "tobuf" on smtp deliveries, which caused core dumps on
large mailing lists

SCCS-vsn: usr.sbin/sendmail/src/deliver.c 3.114
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 3.57
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.200

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/version.c

index d5d5b39..6035683 100644 (file)
@@ -3,7 +3,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)deliver.c   3.113           %G%);
+SCCSID(@(#)deliver.c   3.114           %G%);
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
 
 /*
 **  DELIVER -- Deliver a message to a list of addresses.
@@ -37,7 +37,7 @@ deliver(firstto)
        register struct mailer *m;      /* mailer for this recipient */
        extern bool checkcompat();
        char *pv[MAXPV+1];
        register struct mailer *m;      /* mailer for this recipient */
        extern bool checkcompat();
        char *pv[MAXPV+1];
-       char tobuf[MAXLINE];            /* text line of to people */
+       char tobuf[MAXLINE-50];         /* text line of to people */
        char buf[MAXNAME];
        ADDRESS *ctladdr;
        extern ADDRESS *getctladdr();
        char buf[MAXNAME];
        ADDRESS *ctladdr;
        extern ADDRESS *getctladdr();
@@ -181,6 +181,10 @@ deliver(firstto)
                    to->q_mailer != firstto->q_mailer)
                        continue;
 
                    to->q_mailer != firstto->q_mailer)
                        continue;
 
+               /* avoid overflowing tobuf */
+               if (sizeof tobuf - (strlen(to->q_paddr) + strlen(tobuf) + 1) < 0)
+                       break;
+
 # ifdef DEBUG
                if (tTd(10, 1))
                {
 # ifdef DEBUG
                if (tTd(10, 1))
                {
index 42fb3b0..74fc443 100644 (file)
@@ -1,6 +1,6 @@
 # include "sendmail.h"
 
 # include "sendmail.h"
 
-SCCSID(@(#)parseaddr.c 3.56            %G%);
+SCCSID(@(#)parseaddr.c 3.57            %G%);
 
 /*
 **  PARSE -- Parse an address
 
 /*
 **  PARSE -- Parse an address
@@ -591,20 +591,8 @@ rewrite(pvp, ruleset)
                        }
 # endif DEBUG
 
                        }
 # endif DEBUG
 
-                       /* see if this is a "subroutine" call */
                        rp = *rvp;
                        rp = *rvp;
-                       if (*rp == CALLSUBR)
-                       {
-                               rp = *++rvp;
-# ifdef DEBUG
-                               if (tTd(21, 3))
-                                       printf("-----callsubr %s\n", rp);
-# endif DEBUG
-                               rewrite(pvp, atoi(rp));
-                               rwr = rwr->r_next;
-                               continue;
-                       }
-                       else if (*rp == CANONUSER)
+                       if (*rp == CANONUSER)
                        {
                                rvp++;
                                rwr = rwr->r_next;
                        {
                                rvp++;
                                rwr = rwr->r_next;
@@ -663,7 +651,21 @@ rewrite(pvp, ruleset)
                                }
                        }
                        *avp++ = NULL;
                                }
                        }
                        *avp++ = NULL;
-                       bmove((char *) npvp, (char *) pvp, (avp - npvp) * sizeof *avp);
+                       if (**npvp == CALLSUBR)
+                       {
+                               bmove((char *) &npvp[2], (char *) pvp,
+                                       (avp - npvp - 2) * sizeof *avp);
+# ifdef DEBUG
+                               if (tTd(21, 3))
+                                       printf("-----callsubr %s\n", npvp[1]);
+# endif DEBUG
+                               rewrite(pvp, atoi(npvp[1]));
+                       }
+                       else
+                       {
+                               bmove((char *) npvp, (char *) pvp,
+                                       (avp - npvp) * sizeof *avp);
+                       }
 # ifdef DEBUG
                        if (tTd(21, 4))
                        {
 # ifdef DEBUG
                        if (tTd(21, 4))
                        {
index ef7c372..acc05a8 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.199 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.200 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.199 [%G%]";
+char   Version[] = "3.200 [%G%]";