diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-05 11:37:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-10-05 11:37:02 +0000 |
commit | 27ddb974c6adc06995844e10d2a09af8321b598f (patch) | |
tree | fdb754f2723bcbc5810280eeaa9c0df9c2b6588b /usr.sbin/lpr/lpd/recvjob.c | |
parent | 790e95d4b83f1cc63ee21a13793c98a53b6f9a35 (diff) |
be more paranoid; based on problem report by mhpower@MIT.EDU
Diffstat (limited to 'usr.sbin/lpr/lpd/recvjob.c')
-rw-r--r-- | usr.sbin/lpr/lpd/recvjob.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c index d6b1cebd6dc..f24d92a60f7 100644 --- a/usr.sbin/lpr/lpd/recvjob.c +++ b/usr.sbin/lpr/lpd/recvjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: recvjob.c,v 1.11 1997/07/25 20:12:13 mickey Exp $ */ +/* $OpenBSD: recvjob.c,v 1.12 1997/10/05 11:37:01 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)recvjob.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: recvjob.c,v 1.11 1997/07/25 20:12:13 mickey Exp $"; +static char rcsid[] = "$OpenBSD: recvjob.c,v 1.12 1997/10/05 11:37:01 deraadt Exp $"; #endif #endif /* not lint */ @@ -265,7 +265,8 @@ readfile(file, size) if (err) frecverr("%s: write error", file); if (noresponse()) { /* file sent had bad data in it */ - (void) unlink(file); + if (strchr(file, '/') == NULL) + (void) unlink(file); return(0); } ack(); @@ -330,15 +331,16 @@ static void rcleanup(signo) int signo; { - if (tfname[0]) + if (tfname[0] && strchr(tfname, '/') == NULL) (void) unlink(tfname); - if (dfname[0]) + if (dfname[0] && strchr(dfname, '/') == NULL) { do { do (void) unlink(dfname); while (dfname[2]-- != 'A'); dfname[2] = 'z'; } while (dfname[0]-- != 'd'); + } dfname[0] = '\0'; } |