summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/lpd/recvjob.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-21 07:56:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-21 07:56:48 +0000
commitb50788c60e3cd9d17ebd71879bcf38b1d50b40bd (patch)
tree21a1c1f0a1e83ac5df46ddc46cf7152f2d043fed /usr.sbin/lpr/lpd/recvjob.c
parent21f56891f2decfb088a9909fac292495249a2e59 (diff)
overflow protection
Diffstat (limited to 'usr.sbin/lpr/lpd/recvjob.c')
-rw-r--r--usr.sbin/lpr/lpd/recvjob.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c
index 0b4156c19aa..9d5b252da60 100644
--- a/usr.sbin/lpr/lpd/recvjob.c
+++ b/usr.sbin/lpr/lpd/recvjob.c
@@ -146,7 +146,8 @@ readjob()
do {
if ((size = read(1, cp, 1)) != 1) {
if (size < 0)
- frecverr("%s: Lost connection",printer);
+ frecverr("%s: Lost connection",
+ printer);
return(nfiles);
}
} while (*cp++ != '\n');
@@ -170,7 +171,8 @@ readjob()
* returns
*/
strcpy(cp + 6, from);
- strcpy(tfname, cp);
+ strncpy(tfname, cp, sizeof tfname-1);
+ tfname[sizeof tfname-1] = '\0';
tfname[0] = 't';
if (!chksize(size)) {
(void) write(1, "\2", 1);
@@ -197,7 +199,8 @@ readjob()
(void) write(1, "\2", 1);
continue;
}
- (void) strcpy(dfname, cp);
+ (void) strncpy(dfname, cp, sizeof dfname-1);
+ dfname[sizeof dfname-1] = '\0';
if (index(dfname, '/'))
frecverr("readjob: %s: illegal path name",
dfname);