From 81e0ed7a5f130824f9a2f5a606159822298957c8 Mon Sep 17 00:00:00 2001 From: millert Date: Fri, 17 Jan 1997 15:51:59 +0000 Subject: [PATCH] possible oflow --- usr.sbin/lpr/lpc/cmds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index a03238d72ca..bb2e5c83cbb 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -341,7 +341,8 @@ cleanpr() n++; } if (n == 0) { - strcpy(lp, cp); + strncpy(lp, cp, sizeof(line) - strlen(line) - 1); + line[sizeof(line) - 1] = '\0'; unlinkf(line); } } else { @@ -350,7 +351,8 @@ cleanpr() * been skipped above) or a tf file (which can always * be removed). */ - strcpy(lp, cp); + strncpy(lp, cp, sizeof(line) - strlen(line) - 1); + line[sizeof(line) - 1] = '\0'; unlinkf(line); } } while (++i < nitems); -- 2.20.1