diff options
author | Mike Smith <msmith@FreeBSD.org> | 1998-10-20 05:52:33 +0000 |
---|---|---|
committer | Mike Smith <msmith@FreeBSD.org> | 1998-10-20 05:52:33 +0000 |
commit | 4757e526860c0e462191f3aee9a5da504b7d6ffb (patch) | |
tree | fc4b34f209629c31abe9250e7c2926e5a32f869c /bin | |
parent | c98405d7d1a9ac54f6dac100bc9557670f3e06db (diff) | |
download | src-4757e526860c0e462191f3aee9a5da504b7d6ffb.tar.gz src-4757e526860c0e462191f3aee9a5da504b7d6ffb.zip |
- Fix off-by-one problem in tar where filenames of length 100
and dirnames of length 99 don't archive.
Submitted by: Wilfredo Sanchez <wsanchez@apple.com>
Obtained from: OpenBSD
Notes
Notes:
svn path=/head/; revision=40533
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pax/tar.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c index bde4c459f12d..ba8c6b00081b 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; #endif static const char rcsid[] = - "$Id$"; + "$Id: tar.c,v 1.10 1998/05/15 06:27:47 charnier Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -977,7 +977,7 @@ ustar_wr(arcn) * check the length of the linkname */ if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) || - (arcn->type == PAX_HRG)) && (arcn->ln_nlen > sizeof(hd->linkname))){ + (arcn->type == PAX_HRG)) && (arcn->ln_nlen >= sizeof(hd->linkname))){ pax_warn(1, "Link name too long for ustar %s", arcn->ln_name); return(1); } @@ -1156,17 +1156,16 @@ name_split(name, len) */ if (len <= TNMSZ) return(name); - if (len > (TPFSZ + TNMSZ + 1)) + if (len > (TPFSZ + TNMSZ)) return(NULL); /* * we start looking at the biggest sized piece that fits in the name * field. We walk foward looking for a slash to split at. The idea is * to find the biggest piece to fit in the name field (or the smallest - * prefix we can find) (the -1 is correct the biggest piece would - * include the slash between the two parts that gets thrown away) + * prefix we can find) */ - start = name + len - TNMSZ - 1; + start = name + len - TNMSZ; while ((*start != '\0') && (*start != '/')) ++start; @@ -1184,7 +1183,7 @@ name_split(name, len) * the file would then expand on extract to //str. The len == 0 below * makes this special case follow the spec to the letter. */ - if ((len > TPFSZ) || (len == 0)) + if ((len >= TPFSZ) || (len == 0)) return(NULL); /* |