Graham Percival [Mon, 13 Jun 2016 23:13:06 +0000 (16:13 -0700)]
Remove dead code in archive_entry_xattr_add_entry()
The code seems to be walking through the linked list beginning at
entry->xattr_head, but then it immediately sets xp to be something different.
This is 10-year old code; it was added in the first "POSIX.1e-style Extended
Attribute support" commit, on March 21 2006:
https://svnweb.freebsd.org/base/head/lib/libarchive/archive_entry.c?annotate=156961&pathrev=156961#l1387
Maxin B. John [Fri, 3 Jun 2016 11:09:30 +0000 (14:09 +0300)]
Makefile.am: Remove non-existing file
Fixes this build error:
CC libarchive/archive_write_set_format_gnutar.lo
make[1]: *** No rule to make target
'libarchive/archive_write_set_format_gnutar_filenames.c', needed by
'libarchive/archive_write_set_format_gnutar_filenames.lo'. Stop.
make[1]: Leaving directory '/home/maxin/clone/libarchive'
Makefile:2866: recipe for target 'all' failed
make: *** [all] Error 2
Signed-off-by: Maxin B. John <maxin.john@intel.com>
Tim Kientzle [Wed, 1 Jun 2016 04:01:59 +0000 (21:01 -0700)]
Issue 682: Correctly write gnutar filenames of exactly 512 bytes
Previous code omitted the final zero byte for filenames and
linknames. This is usually okay since the final block is
padded with zero bytes, but if the filename exactly filled
the block, there would be no zero byte.
Tim Kientzle [Sat, 28 May 2016 18:50:39 +0000 (11:50 -0700)]
Issue 711: Be more careful about verifying filename lengths when writing ISO9660 archives
* Don't cast size_t to int, since this can lead to overflow
on machines where sizeof(int) < sizeof(size_t)
* Check a + b > limit by writing it as
a > limit || b > limit || a + b > limit
to avoid problems when a + b wraps around.
Tim Kientzle [Mon, 25 Apr 2016 03:41:12 +0000 (20:41 -0700)]
Default to Windows 7 SDK
Some of our current crypto bindings require the Win7 SDK.
Once we can rework those, this could reasonably be changed
to Win Vista or possibly Win Server 2003.
I'd like to completely remove support for WinXP and earlier.
Tim Kientzle [Mon, 25 Apr 2016 00:13:45 +0000 (17:13 -0700)]
Issue #656: Fix CVE-2016-1541, VU#862384
When reading OS X metadata entries in Zip archives that were stored
without compression, libarchive would use the uncompressed entry size
to allocate a buffer but would use the compressed entry size to limit
the amount of data copied into that buffer. Since the compressed
and uncompressed sizes are provided by data in the archive itself,
an attacker could manipulate these values to write data beyond
the end of the allocated buffer.
This fix provides three new checks to guard against such
manipulation and to make libarchive generally more robust when
handling this type of entry:
1. If an OS X metadata entry is stored without compression,
abort the entire archive if the compressed and uncompressed
data sizes do not match.
2. When sanity-checking the size of an OS X metadata entry,
abort this entry if either the compressed or uncompressed
size is larger than 4MB.
3. When copying data into the allocated buffer, check the copy
size against both the compressed entry size and uncompressed
entry size.
Tim Kientzle [Sun, 24 Apr 2016 22:16:10 +0000 (15:16 -0700)]
Ensure that cryptor, hmac, and xxhash always define at least one symbol. This prevents headaches with compilers and linkers that choke on empty object files.
Tim Kientzle [Sun, 10 Apr 2016 01:10:37 +0000 (18:10 -0700)]
Issue #655: Be more careful verifying sparse file reading
The old logic took a number of shortcuts; this now does a careful
comparison of the template used to generate the file with
the contents read back, verifying that the read blocks reflect
the expected pattern of zero and non-zero bytes and that the
expected number of holes actually appear.
This change introduces support for building on AIX via CMake. `gcc`
warning options are mapped to equivalent options in the `xlc` suite
where possible. The compiler is overridden to be `xlc_r` instead of
`cc` for thread-safe compilation and linking.
Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
Tim Kientzle [Sun, 3 Apr 2016 18:03:22 +0000 (11:03 -0700)]
Issue 550: Fix out-of-bounds read in mtree.
The mtree parser scanned from the end of the string to identify
the filename when the filename is the last element of the line.
If the filename was the entire line, the logic would scan back
to before the start of the string.
The revised logic scans from the beginning of the string
and remembers the last separator position to locate the
trailing filename.
Andrew Gregory [Fri, 15 Jan 2016 07:39:41 +0000 (02:39 -0500)]
Skip root directory symlink check
The first time check_symlinks is called on an absolute path it will use
the entry pathname directly, blanking the leading slash. This leads to
calling lstat on an empty string, which returns ENOENT, terminating the
loop early and falsely marking the path as safe.
Andrew Gregory [Fri, 15 Jan 2016 07:40:00 +0000 (02:40 -0500)]
Restore modified path after lstat
check_symlinks is intended to check each component of a path, but failed
to restore the stripped trailing components after each iteration,
leaving a NUL byte in the middle of the path.
Tim Kientzle [Sun, 21 Feb 2016 20:34:57 +0000 (12:34 -0800)]
Fix for issue #623.
Apparently, people have come to expect that the following
is sufficient to get bit-for-bit identical output from tar:
* Same filenames
* Same contents
* Same uid, gid
* Same mtime (forced via "touch -t <timestamp>")
* Sorting entries
Bsdtar's "restricted pax" format violated this by including
ctime, atime, and birthtime (which are not updated by
'touch -t). So we should only emit those additional time
values in the full pax format.
People who are really serious about generating bit-for-bit
identical archives should really build their own command-line
interface: You can still use libarchive to build the output,
but your custom CLI could sort the entries and strip everything
except a bare minimum of basic metadata.