security problem symbolic link fix
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 31 Mar 1994 04:05:00 +0000 (20:05 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 31 Mar 1994 04:05:00 +0000 (20:05 -0800)
SCCS-vsn: usr.sbin/lpr/lpr/lpr.c 8.3

usr/src/usr.sbin/lpr/lpr/lpr.c

index c89b85d..92f01ea 100644 (file)
@@ -75,7 +75,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)lpr.c      8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)lpr.c      8.3 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -529,7 +529,7 @@ nfile(n)
        register int f;
        int oldumask = umask(0);                /* should block signals */
 
        register int f;
        int oldumask = umask(0);                /* should block signals */
 
-       f = creat(n, FILMOD);
+       f = open(n, O_WRONLY | O_EXCL | O_CREAT, FILMOD);
        (void) umask(oldumask);
        if (f < 0) {
                printf("%s: cannot create %s\n", name, n);
        (void) umask(oldumask);
        if (f < 0) {
                printf("%s: cannot create %s\n", name, n);