[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Re: AMTAR brokenness

From: Gunnar Ritter
Subject: Re: [Bug-tar] Re: AMTAR brokenness
Date: Mon, 19 Apr 2004 18:39:00 +0200
User-agent: nail 10.8pre 4/14/04

Alexandre Duret-Lutz <address@hidden> wrote:

> >>> "Paul" == Paul Eggert <address@hidden> writes:
>  Paul> Alexandre Duret-Lutz <address@hidden> writes:
>  >> address@hidden selects the new pax format defined by POSIX
>  >> +1003.1-2001.  It supports filenames with up to 65535 characters.
>  Paul> Hmm, where did that "65535" come from?  I don't know of any limit of
>  Paul> 65535 bytes (presumably you meant bytes, not characters) that is
>  Paul> required by POSIX.
> I read that in the Heirloom pax manpage
> Maybe its maintainer can enlighten us.

The reason why I introduced this was the following: When cpio/pax
encounters a broken archive with a very large number in the file
name length field, it tries to allocate a lot of memory to store
the file name; it will eventually fail to allocate that memory
and terminate operation immediately. That's bad because if the
header was just skipped, another valid header could follow (with
-k/-K specified).

Thus I introduced some sane limit here. Since cpio does not
currently change its working directory, it is restriced to the
open() limit of PATH_MAX anyway and will get ENAMETOOLONG, which
is at 4096 on most systems. I chose 65535 because I've never seen
a Unix system which even remotely supports names of such length
for open(). But the value is arbitrary and could be raised to any
value as long as enough memory is available to store a file name.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]