diff options
author | imp <imp@FreeBSD.org> | 1998-06-09 03:38:43 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1998-06-09 03:38:43 +0000 |
commit | c530c6747abadfbfd17a453f17fb6f28f550fc7f (patch) | |
tree | a55b4aeb1d05d42631525f1922f949034a783d82 /bin/cp/utils.c | |
parent | ced2b136af7264a4ab5675b0bee8e972c23f9ea7 (diff) | |
download | FreeBSD-src-c530c6747abadfbfd17a453f17fb6f28f550fc7f.zip FreeBSD-src-c530c6747abadfbfd17a453f17fb6f28f550fc7f.tar.gz |
Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.
Inspired by: OpenBSD's changes in this area by theo de raadt
Diffstat (limited to 'bin/cp/utils.c')
-rw-r--r-- | bin/cp/utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/cp/utils.c b/bin/cp/utils.c index b261e38..3ee49f6 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94"; #endif static const char rcsid[] = - "$Id: utils.c,v 1.17 1998/05/06 06:50:25 charnier Exp $"; + "$Id: utils.c,v 1.18 1998/05/13 07:25:17 charnier Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -208,7 +208,7 @@ copy_link(p, exists) int len; char link[MAXPATHLEN]; - if ((len = readlink(p->fts_path, link, sizeof(link))) == -1) { + if ((len = readlink(p->fts_path, link, sizeof(link) - 1)) == -1) { warn("readlink: %s", p->fts_path); return (1); } |