--- 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 @@
 {
     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;
+    }
+    close( fd );
+    unlink( tmpfil );
     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;
