summaryrefslogtreecommitdiffstats
path: root/bin/pax
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1998-06-09 03:38:43 +0000
committerimp <imp@FreeBSD.org>1998-06-09 03:38:43 +0000
commitc530c6747abadfbfd17a453f17fb6f28f550fc7f (patch)
treea55b4aeb1d05d42631525f1922f949034a783d82 /bin/pax
parentced2b136af7264a4ab5675b0bee8e972c23f9ea7 (diff)
downloadFreeBSD-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/pax')
-rw-r--r--bin/pax/ftree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c
index 8a264aa..b9f32e3 100644
--- a/bin/pax/ftree.c
+++ b/bin/pax/ftree.c
@@ -40,7 +40,7 @@
static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: ftree.c,v 1.10 1998/05/15 06:27:42 charnier Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -508,14 +508,14 @@ next_file(arcn)
* have to read the symlink path from the file
*/
if ((cnt = readlink(ftent->fts_path, arcn->ln_name,
- PAXPATHLEN)) < 0) {
+ PAXPATHLEN - 1)) < 0) {
sys_warn(1, errno, "Unable to read symlink %s",
ftent->fts_path);
continue;
}
/*
* set link name length, watch out readlink does not
- * allways null terminate the link path
+ * allways NUL terminate the link path
*/
arcn->ln_name[cnt] = '\0';
arcn->ln_nlen = cnt;
OpenPOWER on IntegriCloud