summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail/temp.c
diff options
context:
space:
mode:
authorthepish <thepish@FreeBSD.org>1998-10-10 09:58:20 +0000
committerthepish <thepish@FreeBSD.org>1998-10-10 09:58:20 +0000
commitbaece423c7edaa616079760a7a4c8602a608e68d (patch)
tree7a7bb8a08e738d265239042fd71c7affda0210a8 /usr.bin/mail/temp.c
parentbcaad08a6991f0785956d31ba4016d0a7cc48687 (diff)
downloadFreeBSD-src-baece423c7edaa616079760a7a4c8602a608e68d.zip
FreeBSD-src-baece423c7edaa616079760a7a4c8602a608e68d.tar.gz
PR: bin/8250
protect against buffer overruns in mail temporary files.
Diffstat (limited to 'usr.bin/mail/temp.c')
-rw-r--r--usr.bin/mail/temp.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c
index 37f6026..ef867cc 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$";
+ "$Id: temp.c,v 1.3 1997/07/24 06:56:33 charnier Exp $";
#endif /* not lint */
#include "rcv.h"
@@ -49,11 +49,11 @@ static const char rcsid[] =
* Give names to all the temporary files that we will need.
*/
-char tempMail[24];
-char tempQuit[24];
-char tempEdit[24];
-char tempResid[24];
-char tempMesg[24];
+char *tempMail;
+char *tempQuit;
+char *tempEdit;
+char *tempResid;
+char *tempMesg;
char *tmpdir;
void
@@ -74,14 +74,23 @@ tinit()
tmpdir = cp;
}
+ tempMail=(char *)malloc(len+sizeof("RsXXXXXX"));
strcpy(tempMail, tmpdir);
mktemp(strcat(tempMail, "RsXXXXXX"));
+
+ tempResid=(char *)malloc(len+sizeof("RqXXXXXX"));
strcpy(tempResid, tmpdir);
mktemp(strcat(tempResid, "RqXXXXXX"));
+
+ tempQuit=(char *)malloc(len+sizeof("RmXXXXXX"));
strcpy(tempQuit, tmpdir);
mktemp(strcat(tempQuit, "RmXXXXXX"));
+
+ tempEdit=(char *)malloc(len+sizeof("ReXXXXXX"));
strcpy(tempEdit, tmpdir);
mktemp(strcat(tempEdit, "ReXXXXXX"));
+
+ tempMesg=(char *)malloc(len+sizeof("RxXXXXXX"));
strcpy(tempMesg, tmpdir);
mktemp(strcat(tempMesg, "RxXXXXXX"));
OpenPOWER on IntegriCloud