Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Todd C . Miller
On Wed, 17 Apr 2024 00:42:32 +0200, Jeremie Courreges-Anglas wrote: > Well the second sizeof should take care of it, or are you suggesting > PAXPATHLEN+1+1...? :-| > > char buf[sizeof("30xx linkpath=") - 1 + PAXPATHLEN + sizeof("\n")]; No, you are correct, I just missed the second one. OK m

Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Jeremie Courreges-Anglas
On Tue, Apr 16, 2024 at 04:29:32PM -0600, Todd C. Miller wrote: > On Wed, 17 Apr 2024 00:08:30 +0200, Jeremie Courreges-Anglas wrote: > > > Indeed, spotted too late, thanks. But maybe the latter looks, ahem, nicer? > > The name and ln_name buffers are sized using it. > > I don't think PAXPATHLEN

Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Todd C . Miller
On Wed, 17 Apr 2024 00:08:30 +0200, Jeremie Courreges-Anglas wrote: > Indeed, spotted too late, thanks. But maybe the latter looks, ahem, nicer? > The name and ln_name buffers are sized using it. I don't think PAXPATHLEN includes space for the NUL so maybe this should be PAXPATHLEN+1. Or just l

Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Jeremie Courreges-Anglas
On Tue, Apr 16, 2024 at 03:54:41PM -0600, Todd C. Miller wrote: > On Tue, 16 Apr 2024 23:39:50 +0200, Jeremie Courreges-Anglas wrote: > > > Here's a cheap trick. Testing with path=... longer than PATH_MAX > > results in broken behavior. If you want to test this with symbolic > > links and long l

Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Todd C . Miller
On Tue, 16 Apr 2024 23:39:50 +0200, Jeremie Courreges-Anglas wrote: > Here's a cheap trick. Testing with path=... longer than PATH_MAX > results in broken behavior. If you want to test this with symbolic > links and long linkpath=... please use the latest tar.c. > > There's probably a better way

Re: pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Jeremie Courreges-Anglas
On Tue, Apr 16, 2024 at 06:23:18PM +0200, Caspar Schutijser wrote: > Hi, > > While I was testing jca@'s diff to make the pax format the > default for tar(1), I ran into the following bug in the code > that reads extended headers. (To be clear: this has nothing to > do with the code that *writes* e

pax/tar: reading extended headers of > 512 bytes fails

2024-04-16 Thread Caspar Schutijser
Hi, While I was testing jca@'s diff to make the pax format the default for tar(1), I ran into the following bug in the code that reads extended headers. (To be clear: this has nothing to do with the code that *writes* extended headers and/or jca@'s diff.) If the file name of the file in the archi