summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-10-19 05:46:13 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-10-19 05:46:13 +0000
commita05a0d13ebfeddff78d3b1f3594451d49bd11c10 (patch)
treee8cba5856907570d35cce7dcf6d72b79027f669a
parent1a704b45fd5d7dc1632319dbbb4037db9e4886c2 (diff)
Fix off-by-one error when adding files of exactly 100 characters; wsanchez@apple.com
-rw-r--r--bin/pax/tar.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/pax/tar.c b/bin/pax/tar.c
index c73657d5d85..4c1b663d19b 100644
--- a/bin/pax/tar.c
+++ b/bin/pax/tar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tar.c,v 1.13 1998/09/26 21:29:41 millert Exp $ */
+/* $OpenBSD: tar.c,v 1.14 1998/10/19 05:46:12 millert Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: tar.c,v 1.13 1998/09/26 21:29:41 millert Exp $";
+static char rcsid[] = "$OpenBSD: tar.c,v 1.14 1998/10/19 05:46:12 millert Exp $";
#endif
#endif /* not lint */
@@ -995,7 +995,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))){
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
return(1);
}
@@ -1176,17 +1176,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;
@@ -1204,7 +1203,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);
/*