summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-10-10 19:01:47 +0000
committerbde <bde@FreeBSD.org>1998-10-10 19:01:47 +0000
commit0d02aaceb91d42dfaac22d30bacee101b095d096 (patch)
tree21125b9b17c14d704bc28edf3a0db1c1c29344ba /usr.bin/mail
parente528e28bfe8d18151ba1f7c04a2bc17b142d9dee (diff)
downloadFreeBSD-src-0d02aaceb91d42dfaac22d30bacee101b095d096.zip
FreeBSD-src-0d02aaceb91d42dfaac22d30bacee101b095d096.tar.gz
Fixed gross breakage in previous commit. The malloc sizes for the
temporary file names were uninitialized if TMPDIR was set and 1 too small otherwise. Fixed style bugs in previous commit. Fixed missing checks for malloc failure in previous commit. Report malloc failure consistently, at least in temp.c.
Diffstat (limited to 'usr.bin/mail')
-rw-r--r--usr.bin/mail/temp.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c
index ef867cc..5101a74 100644
--- a/usr.bin/mail/temp.c
+++ b/usr.bin/mail/temp.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: temp.c,v 1.3 1997/07/24 06:56:33 charnier Exp $";
+ "$Id: temp.c,v 1.4 1998/10/10 09:58:20 thepish Exp $";
#endif /* not lint */
#include "rcv.h"
@@ -67,30 +67,31 @@ tinit()
else {
len = strlen(tmpdir);
if ((cp = malloc(len + 2)) == NULL)
- err(1, NULL);
+ panic("Out of memory");
(void)strcpy(cp, tmpdir);
cp[len] = '/';
cp[len + 1] = '\0';
tmpdir = cp;
}
-
- tempMail=(char *)malloc(len+sizeof("RsXXXXXX"));
+ len = strlen(tmpdir);
+ if ((tempMail = malloc(len + sizeof("RsXXXXXX"))) == NULL)
+ panic("Out of memory");
strcpy(tempMail, tmpdir);
mktemp(strcat(tempMail, "RsXXXXXX"));
-
- tempResid=(char *)malloc(len+sizeof("RqXXXXXX"));
+ if ((tempResid = malloc(len + sizeof("RqXXXXXX"))) == NULL)
+ panic("Out of memory");
strcpy(tempResid, tmpdir);
mktemp(strcat(tempResid, "RqXXXXXX"));
-
- tempQuit=(char *)malloc(len+sizeof("RmXXXXXX"));
+ if ((tempQuit = malloc(len + sizeof("RmXXXXXX"))) == NULL)
+ panic("Out of memory");
strcpy(tempQuit, tmpdir);
mktemp(strcat(tempQuit, "RmXXXXXX"));
-
- tempEdit=(char *)malloc(len+sizeof("ReXXXXXX"));
+ if ((tempEdit = malloc(len + sizeof("ReXXXXXX"))) == NULL)
+ panic("Out of memory");
strcpy(tempEdit, tmpdir);
mktemp(strcat(tempEdit, "ReXXXXXX"));
-
- tempMesg=(char *)malloc(len+sizeof("RxXXXXXX"));
+ if ((tempMesg = malloc(len + sizeof("RxXXXXXX"))) == NULL)
+ panic("Out of memory");
strcpy(tempMesg, tmpdir);
mktemp(strcat(tempMesg, "RxXXXXXX"));
OpenPOWER on IntegriCloud