From root@gits.dyndns.org  Thu Jul 11 19:41:42 2002
Return-Path: <root@gits.dyndns.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7F88A37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Jul 2002 19:41:42 -0700 (PDT)
Received: from smtp.noos.fr (descartes.noos.net [212.198.2.74])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7C73A43E6A
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Jul 2002 19:41:40 -0700 (PDT)
	(envelope-from root@gits.dyndns.org)
Received: (qmail 50376685 invoked by uid 0); 12 Jul 2002 02:41:38 -0000
Received: from unknown (HELO gits.gits.dyndns.org) ([212.198.229.153]) (envelope-sender <root@gits.dyndns.org>)
          by 212.198.2.74 (qmail-ldap-1.03) with SMTP
          for <FreeBSD-gnats-submit@freebsd.org>; 12 Jul 2002 02:41:38 -0000
Received: from gits.gits.dyndns.org (njmjj5bclu8zqmm6@localhost [127.0.0.1])
	by gits.gits.dyndns.org (8.12.5/8.12.5) with ESMTP id g6C2fbTL027439;
	Fri, 12 Jul 2002 04:41:38 +0200 (CEST)
	(envelope-from root@gits.dyndns.org)
Received: (from root@localhost)
	by gits.gits.dyndns.org (8.12.5/8.12.5/Submit) id g6C2fbF3027438;
	Fri, 12 Jul 2002 04:41:37 +0200 (CEST)
	(envelope-from root)
Message-Id: <200207120241.g6C2fbF3027438@gits.gits.dyndns.org>
Date: Fri, 12 Jul 2002 04:41:37 +0200 (CEST)
From: Cyrille Lefevre <cyrille.lefevre@laposte.net>
Reply-To: Cyrille Lefevre <cyrille.lefevre@laposte.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Murray Stokely <murray@freebsd.org>
Subject: pax may not handle correctly some tar archives
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         40466
>Category:       bin
>Synopsis:       [patch] pax may not handle correctly some tar archives
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 11 19:50:00 PDT 2002
>Closed-Date:    Fri Dec 10 15:53:41 GMT 2004
>Last-Modified:  Fri Dec 10 15:53:41 GMT 2004
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
ACME
>Environment:
System: FreeBSD gits 4.6-STABLE FreeBSD 4.6-STABLE #16: Sat Jul 6 19:06:54 CEST 2002 root@gits:/disk2/freebsd/stable/src/sys/compile/CUSTOM i386

>Description:
	On Tue, Jun 11, 2002 at 05:07:42PM -0700, Murray Stokely wrote:
	> Sorry, I think its too late at this point.
	> 
	> On Wed, Jun 12, 2002 at 01:56:09AM +0200, Cyrille Lefevre wrote:
	> > here is a last minute fix concerning pax, maybe it's not too late
	> > to integrate it in 4.6 -release ?
	> 
	> > On Jun 7, 2002 01:27:31 pm +0200, Cyrille Lefevre wrote:
	> > > On Fri, Jun 07, 2002 at 02:15:09AM -0400, Trevor Johnson wrote:
	> > > > Dan Nelson wrote:
	> > > [snip]
	> > > > According to Mr. Schilling's testing, GNU tar 1.13.25 has a bug:
	> > > > ftp://ftp.fokus.gmd.de/pub/unix/star/testscripts/README.gtarfail . I guess
	> > > > it qualifies as a "non-trivial program". :-)
	> > > 
	> > > FYI, the current pax implementation is able to handle the following
	> > > archives from ftp://ftp.fokus.gmd.de/pub/unix/star/testscripts/ :
	> > > 
	> > > 	100char_longlink.tar
	> > > 	gtarfail.tar
	> > > 	gtarfail2.tar
	> > > 
	> > > but miserably fail on this one :
	> > > 
	> > > 	long.ustar.gz
	> > > 
	> > > $ uname -a
	> > > FreeBSD gits 4.6-RC FreeBSD 4.6-RC #7: Sun Jun  2 16:33:05 CEST 2002     root@gits:/disk2/4.x-stable/src/sys/compile/CUSTOM  i386
	> > > $ pax -zvf 
	> > > -rw-r--r--  1 486              cvs            4 Apr 19  2000 ___________________
	> > > ___________________________________________________________________________D_099
	> > > /_______________________________________________________________________________
	> > > __________________1000000644 0000746 0003720 00000000004 07077317140 0055507 0
	> > > 
	> > > $ star -zvtf 
	> > >       4 -rw-r--r-- jes/cats Apr 19 13:54 2000 __________________________________
	> > > ____________________________________________________________D_099/______________
	> > > ________________________________________________________________________________
	> > > ___100
	> > > 
	> > > I'll try to fix this...
	> > 
	> > done, here is the patch which may be integrated to 4.6 -release ?
>How-To-Repeat:
	see above.
>Fix:

Index: /tmp/src/bin/pax/tar.c
===================================================================
RCS file: /home/ncvs/src/bin/pax/tar.c,v
retrieving revision 1.19
diff -u -r1.19 tar.c
--- /tmp/src/bin/pax/tar.c	16 May 2002 01:57:13 -0000	1.19
+++ /tmp/src/bin/pax/tar.c	11 Jun 2002 23:39:16 -0000
@@ -758,7 +758,7 @@
 		*dest++ = '/';
 		cnt++;
 	}
-	arcn->nlen = cnt + l_strncpy(dest, hd->name, sizeof(arcn->name) - cnt);
+	arcn->nlen = cnt + l_strncpy(dest, hd->name, MIN(TNMSZ + 1, sizeof(arcn->name) - cnt) - 1);
 	arcn->name[arcn->nlen] = '\0';
 
 	/*

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: kris 
State-Changed-When: Sat Jul 12 18:30:26 PDT 2003 
State-Changed-Why:  
The test archives are no longer available, but this problem 
may be fixed in later releases.  Can you please verify? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40466 

From: Kris Kennaway <kris@obsecurity.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: [cyrille.lefevre@laposte.net: Re: bin/40466: pax may not handle correctly some tar archives]
Date: Fri, 17 Oct 2003 17:31:50 -0700

 ----- Forwarded message from Cyrille Lefevre <cyrille.lefevre@laposte.net> -----
 
 On Sat, Jul 12, 2003 at 06:30:57PM -0700, Kris Kennaway wrote:
 > Synopsis: pax may not handle correctly some tar archives
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: kris
 > State-Changed-When: Sat Jul 12 18:30:26 PDT 2003
 > State-Changed-Why: 
 > The test archives are no longer available, but this problem
 > may be fixed in later releases.  Can you please verify?
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=40466
 
 ftp://ftp.fokus.gmd.de/pub/unix/star/testscripts/
 seems to have moved here :
 ftp://ftp.berlios.de/pub/star/testscripts/
 
 Cyrille.
 -- 
 Cyrille Lefevre                 mailto:cyrille.lefevre@laposte.net
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
 ----- End forwarded message -----
State-Changed-From-To: analyzed->open 
State-Changed-By: vs 
State-Changed-When: Wed Nov 3 09:33:54 GMT 2004 
State-Changed-Why:  
This is still a problem on 5.3-RC2. Cyrille's patch still applies. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40466 
State-Changed-From-To: open->patched 
State-Changed-By: yar 
State-Changed-When: Sat Nov 13 10:57:14 GMT 2004 
State-Changed-Why:  
This one and a number of similar bugs fixed in CURRENT pax. 
Thanks! 


Responsible-Changed-From-To: freebsd-bugs->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Sat Nov 13 10:57:14 GMT 2004 
Responsible-Changed-Why:  
I take this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40466 
State-Changed-From-To: patched->closed 
State-Changed-By: yar 
State-Changed-When: Fri Dec 10 15:51:45 GMT 2004 
State-Changed-Why:  
The problems with pax mishandling file names of the maximum length have been 
addressed in all active branches.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40466 
>Unformatted:
