tar segfaults (busybox 1.8.1)

Denys Vlasenko vda.linux at googlemail.com
Fri Nov 16 20:22:19 UTC 2007


On Friday 16 November 2007 11:38, Tito wrote:
> > Example
> >
> > The example below shows the ASCII dump of a header block from a tar file
> > created using the GNU tar program. It was dumped with the od program.
> > The "ustar" magic string followed by two spaces can be seen, meaning that
> > the tar file is in GNU format, partially incompatible with the true USTAR
> > standard (in POSIX.1-1988), which has the signature "ustar" followed by a
> > NUL character.
> >
> > 0000000   e   t   c   /   p   a   s   s   w   d nul nul nul nul nul nul
> > 0000020 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
> > *
> > 0000140 nul nul nul nul   0   1   0   0   6   4   4 nul   0   0   0   0
> > 0000160   0   0   0 nul   0   0   0   0   0   0   0 nul   0   0   0   0
> > 0000200   0   0   4   1   3   5   5 nul   1   0   1   5   5   0   6   1
> > 0000220   1   0   5 nul   0   1   1   5   5   6 nul  sp   0 nul nul nul
> > 0000240 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul
> > *
> > 0000400 nul   u   s   t   a   r  sp  sp nul   r   o   o   t nul nul nul
...
>
> Hi,
> maybe then:
>
> strcpy(hp->magic, "ustar");
> strcpy(hp->version, "  ");
>
> could be a more pragmatic solution?

it will create

"ustar\0  \0"

with last \0 overflowing version[2], and will be incompatible
from both POSIX and GNU 'ustar' formats.
--
vda



More information about the busybox mailing list