summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/lpc
diff options
context:
space:
mode:
authorlebel <lebel@cvs.openbsd.org>2001-06-22 15:27:21 +0000
committerlebel <lebel@cvs.openbsd.org>2001-06-22 15:27:21 +0000
commit439641e5117516da0f78aedda2425eac0baf470b (patch)
tree8cc10e6e88a14962293df3c2e1374670d889ce4e /usr.sbin/lpr/lpc
parentabf4883fbd8fcc18a2d0114717652d64ab292c6a (diff)
use strlcpy vs strncpy+a[len-1]='\0'
Diffstat (limited to 'usr.sbin/lpr/lpc')
-rw-r--r--usr.sbin/lpr/lpc/cmds.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c
index d1c66e1a7f3..8c04c7d4dcb 100644
--- a/usr.sbin/lpr/lpc/cmds.c
+++ b/usr.sbin/lpr/lpc/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.10 2000/11/21 07:22:53 deraadt Exp $ */
+/* $OpenBSD: cmds.c,v 1.11 2001/06/22 15:27:20 lebel Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)cmds.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.10 2000/11/21 07:22:53 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.11 2001/06/22 15:27:20 lebel Exp $";
#endif
#endif /* not lint */
@@ -347,8 +347,7 @@ cleanpr()
n++;
}
if (n == 0) {
- strncpy(lp, cp, sizeof(line) - strlen(line) - 1);
- line[sizeof(line) - 1] = '\0';
+ strlcpy(lp, cp, sizeof(line) - strlen(line));
unlinkf(line);
}
} else {
@@ -357,8 +356,7 @@ cleanpr()
* been skipped above) or a tf file (which can always
* be removed).
*/
- strncpy(lp, cp, sizeof(line) - strlen(line) - 1);
- line[sizeof(line) - 1] = '\0';
+ strlcpy(lp, cp, sizeof(line) - strlen(line));
unlinkf(line);
}
} while (++i < nitems);