• Joe Tsai's avatar
    archive/tar: forbid NUL character in string fields · 019d8a07
    Joe Tsai authored
    USTAR and GNU strings are NUL-terminated. Thus, we should never
    allow the NUL terminator, otherwise we will lose data round-trip.
    
    Relevant specification text:
    <<<
    The fields magic, uname, and gname are character strings each terminated by a NUL character.
    >
    > Technically, PAX keys and values should be UTF-8, but the observance
    > of invalid files in the wild causes us to be more liberal.
    > <<<
    > The <length> field, <blank>, <equals-sign>, and <newline> shown shall
    > be limited to the portable character set, as encoded in UTF-8.
    
    Thus, we only reject NULs in PAX keys, and NULs for PAX values
    representing the USTAR string fields (i.e., path, linkpath, uname, gname).
    These are treated more strictly because they represent strings that
    are typically represented as C-strings on POSIX systems.
    
    Change-Id: I305b794d9d966faad852ff660bd0b3b0964e52bf
    Reviewed-on: https://go-review.googlesource.com/14724
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    019d8a07
Name
Last commit
Last update
..
gnu-incremental.tar Loading commit data...
gnu-long-nul.tar Loading commit data...
gnu-multi-hdrs.tar Loading commit data...
gnu.tar Loading commit data...
hardlink.tar Loading commit data...
hdr-only.tar Loading commit data...
invalid-go17.tar Loading commit data...
issue10968.tar Loading commit data...
issue11169.tar Loading commit data...
issue12435.tar Loading commit data...
neg-size.tar Loading commit data...
nil-uid.tar Loading commit data...
pax-bad-hdr-file.tar Loading commit data...
pax-bad-mtime-file.tar Loading commit data...
pax-multi-hdrs.tar Loading commit data...
pax-nul-path.tar Loading commit data...
pax-nul-xattrs.tar Loading commit data...
pax-path-hdr.tar Loading commit data...
pax-pos-size-file.tar Loading commit data...
pax.tar Loading commit data...
small.txt Loading commit data...
small2.txt Loading commit data...
sparse-formats.tar Loading commit data...
star.tar Loading commit data...
ustar-file-reg.tar Loading commit data...
ustar.issue12594.tar Loading commit data...
ustar.tar Loading commit data...
v7.tar Loading commit data...
writer-big-long.tar Loading commit data...
writer-big.tar Loading commit data...
writer.tar Loading commit data...
xattrs.tar Loading commit data...