openbsd-ports/mail/nmh/patches/patch-ab

26 lines
683 B
Plaintext
Raw Normal View History

1998-07-26 20:15:09 -04:00
--- sbr/m_scratch.c.orig Sun Jan 4 14:15:18 1998
+++ sbr/m_scratch.c Sun Jul 26 16:30:44 1998
@@ -13,13 +13,19 @@
1998-04-30 00:24:30 -04:00
{
char *cp;
static char buffer[BUFSIZ], tmpfil[BUFSIZ];
+ int fd;
- sprintf (tmpfil, "%sXXXXXX", template);
- mktemp (tmpfil);
+ snprintf (tmpfil, BUFSIZ, "%sXXXXXX", template);
+ fd = mkstemp( tmpfil );
+ if ( fd == -1 ) {
+ return 0;
+ }
1998-07-26 20:15:09 -04:00
+ close( fd );
+ unlink( tmpfil );
1998-04-30 00:24:30 -04:00
if ((cp = r1bindex (file, '/')) == file)
strcpy (buffer, tmpfil);
else
- sprintf (buffer, "%.*s%s", cp - file, file, tmpfil);
+ snprintf (buffer, BUFSIZ, "%.*s%s", cp - file, file, tmpfil);
unlink (buffer);
return buffer;