diff options
author | dima <dima@FreeBSD.org> | 1997-07-08 21:03:16 +0000 |
---|---|---|
committer | dima <dima@FreeBSD.org> | 1997-07-08 21:03:16 +0000 |
commit | 8efa570208cfaf0bf951166d1a33d2ee6cce0490 (patch) | |
tree | 567e480570ab34401157ce1180d5a89d547fde8b | |
parent | bebb78e2440389652ded4c7a368d324b24995241 (diff) | |
download | FreeBSD-src-8efa570208cfaf0bf951166d1a33d2ee6cce0490.zip FreeBSD-src-8efa570208cfaf0bf951166d1a33d2ee6cce0490.tar.gz |
Fixed buffer overflow.
Reviewed by: Warner
-rw-r--r-- | usr.sbin/lpr/lpr/lpr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/lpr/lpr/lpr.c b/usr.sbin/lpr/lpr/lpr.c index 5cbfde1..e362f03 100644 --- a/usr.sbin/lpr/lpr/lpr.c +++ b/usr.sbin/lpr/lpr/lpr.c @@ -45,7 +45,7 @@ static char copyright[] = #ifndef lint static char sccsid[] = "From: @(#)lpr.c 8.4 (Berkeley) 4/28/95" - "\n$Id: lpr.c,v 1.14 1997/03/31 05:10:18 imp Exp $\n"; + "\n$Id: lpr.c,v 1.15 1997/05/13 20:46:45 brian Exp $\n"; #endif /* not lint */ /* @@ -433,10 +433,10 @@ linked(file) register char *file; { register char *cp; - static char buf[BUFSIZ]; + static char buf[MAXPATHLEN]; if (*file != '/') { - if (getcwd(buf,sizeof(buf)) == NULL) + if (getcwd(buf, sizeof(buf)) == NULL) return(NULL); while (file[0] == '.') { switch (file[1]) { @@ -453,8 +453,8 @@ linked(file) } break; } - strcat(buf, "/"); - strcat(buf, file); + strncat(buf, "/", sizeof(buf) - strlen(buf) - 1); + strncat(buf, file, sizeof(buf) - strlen(buf) - 1); file = buf; } return(symlink(file, dfname) ? NULL : file); |