| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Because at that point, you may as well replace the whole thing with
strcmp
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
“free”
The function “free” is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
https://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first
This issue was fixed by using the software “Coccinelle 1.0.7”.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A cpio "newc" archive with a namelength of "FFFFFFFF", if read on a
system with a 32-bit size_t, would result in namelength + name_pad
overflowing 32 bits and libarchive attempting to copy 2^32-1 bytes
from a 2-byte buffer, with appropriately hilarious results.
Check for this overflow and fail; there's no legitimate reason for a
cpio archive to contain a file with a name over 4 billion characters
in length.
Reported by: Eyal Itkin
Security: Corrupt archives can cause libarchive to crash on
32-bit platforms.
Sponsored by: Tarsnap Backup Inc.
|
|
|
|
| |
Reported-By: OSS-Fuzz issue 577
|
|
|
|
|
|
| |
If entry was a symlink, the old code replaced the pointer with linkname.
Reported-By: OSS-Fuzz issue 504
|
|
|
|
| |
Reported-By: OSS-Fuzz issue 422
|
|
|
| |
Sponsored by: Tarsnap Backup Inc.
|
|
|
|
| |
Sponsored by: Tarsnap Backup Inc.
|
| |
|
|
|
|
|
|
|
| |
trying to read a cpio header.
Suggested by Issue #395, although the actual problem there
seems to have been the same as Issue #394.
|
|
|
|
|
| |
Root cause here was an implicit cast that resulted in
reading very large file sizes as negative numbers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change you can detect if an archive entry is encrypted. The
archive formats covered with this change are: ZIP, RAR, and 7zip. Other
formats can be added quite simply by looking at the already supported
formats. For all the already supported formats we have tests that check
if:
* an archive entries's data is encryped (data test)
* an archive entries's metadata is encrypted (header test)
* one file is encrypted while another is not (partially test)
These new functions are introduced.
int archive_read_format_capabilities(struct archive*)
Returns a bitmask of capabilities that are supported by the archive
format reader. If the reader has no special capabilities,
ARCHIVE_READ_FORMAT_CAPS_NONE is returned; otherwise 0 is returned.
You can call this function even before reading the first header from
an archive.
Return Values:
* ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA
The reader supports detection of encrypted data.
* ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA
The reader supports detection of encrypted metadata (e.g.
filename, modification time, size, etc.)
* ARCHIVE_READ_FORMAT_CAPS_NONE
None of the above capabilities. If this value is returned, this
doesn't mean that the format itself doesn't support any type of
encryption it simply means that the reader is not capable of
detecting it.
int archive_read_has_encrypted_entries(struct archive *)
Returns "true" (non-zero) if the archive contains at least one
encrypted entry, no matter which encryption type (data or metadata)
is used; otherwise 0 is returned.
You should only call this function after reading the first header
from an archive.
NOTE: I'm not sure that this function will stay in for long.
int archive_entry_is_data_encrypted(struct archive_entry*)
Returns "true" (non-zero) if the archive entry's data is encrypted;
otherwise 0 is returned. You can call this function after calling
archive_read_next_header().
int archive_entry_is_metadata_encrypted(struct archive_entry*)
Returns "true" (non-zero) if the archive entry's metadata is
encrypted; otherwise 0 is returned. You can call this function after
calling archive_read_next_header().
int archive_entry_is_encrypted(struct archive_entry*)
Returns "true" (non-zero) if either the archive entry's data and/or
it's metadata is encrypted; otherwise 0 is returned. You can call
this function after calling archive_read_next_header().
If you use archive_read_format_capabilities() in combination with one of
the archive_entry_is_[data|metadata]_encrypted() functions, you can be
sure that you've encountered an encrypted entry. This allows you to
react differently depending on libarchive's return codes. For instance,
you might want to skip encrypted files from being extracted until
decryption support has been implemented.
Here's how I generated the 7zip test files:
-------------------------------------------
With header encrpytion (-mhe=on):
$ rm -f test_read_format_7zip_encryption_header.7z
$ echo "foo" > bar.txt && 7z a -mhe=on -p12345678 \
test_read_format_7zip_encryption_header.7z bar.txt
$ uuencode test_read_format_7zip_encryption_header.7z \
test_read_format_7zip_encryption_header.7z > \
test_read_format_7zip_encryption_header.7z.uu
Without header encrpytion (-mhe=off):
$ rm -f test_read_format_7zip_encryption.7z
$ echo "foo" > bar.txt && 7z a -mhe=off -p12345678 \
test_read_format_7zip_encryption.7z bar.txt
$ uuencode test_read_format_7zip_encryption.7z \
test_read_format_7zip_encryption.7z > \
test_read_format_7zip_encryption.7z.uu
Partially encrypted archive:
$ rm -f test_read_format_7zip_encryption_partially.7z
$ echo "foo" > bar_unencrypted.txt && 7z a \
test_read_format_7zip_encryption_partially.7z bar_unencrypted.txt
$ echo "foo" > bar_encrypted.txt && 7z a -mhe=off -p12345678 \
test_read_format_7zip_encryption_partially.7z bar_encrypted.txt
$ uuencode test_read_format_7zip_encryption_partially.7z \
test_read_format_7zip_encryption_partially.7z > \
test_read_format_7zip_encryption_partially.7z.uu
Here's how I generated the RAR test files:
------------------------------------------
These are the files we can will add to the archives:
echo "data of foo.txt" > foo.txt
echo "data of bar.txt" > bar.txt
With header encrpytion (-hp):
rm -f test_read_format_rar_encryption_header.rar
rar a -hp12345678 test_read_format_rar_encryption_header.rar \
foo.txt bar.txt
uuencode test_read_format_rar_encryption_header.rar \
test_read_format_rar_encryption_header.rar > \
test_read_format_rar_encryption_header.rar.uu
Without header encrpytion (-p):
rm -f test_read_format_rar_encryption_data.rar
rar a -p12345678 test_read_format_rar_encryption_data.rar \
foo.txt bar.txt
uuencode test_read_format_rar_encryption_data.rar \
test_read_format_rar_encryption_data.rar > \
test_read_format_rar_encryption_data.rar.uu
Partially encrypted archive (-p on "foo.txt" and no password on "bar.txt"):
rm -f test_read_format_rar_encryption_partially.rar
rar a -p12345678 test_read_format_rar_encryption_partially.rar foo.txt
rar a test_read_format_rar_encryption_partially.rar bar.txt
uuencode test_read_format_rar_encryption_partially.rar \
test_read_format_rar_encryption_partially.rar > \
test_read_format_rar_encryption_partially.rar.uu
Here's how I generated the ZIP test files:
------------------------------------------
This is how I've created the test files:
These are the files we will add to the archives:
On Windows:
echo "data of foo.txt" > foo.txt
echo "data of bar.txt" > bar.txt
For the creation of the Zip archives I've used the
PKZIP Command Line Add-On available from here:
http://comm.pkware.com/pkzip-cli-download.html
With header (aka central directory) encrpytion (-cd):
On Windows:
del /F test_read_format_zip_encryption_header.zip
pkzipc.exe -add -cryptalgorithm=AES,256 -passphrase=12345678 -cd test_read_format_zip_encryption_header.zip foo.txt bar.txt
On Linux:
uuencode test_read_format_zip_encryption_header.zip \
test_read_format_zip_encryption_header.zip > \
test_read_format_zip_encryption_header.zip.uu
Without header encrpytion:
On Windows:
del /F test_read_format_zip_encryption_data.zip
pkzipc.exe -add -cryptalgorithm=AES,256 -passphrase=12345678 test_read_format_zip_encryption_data.zip foo.txt bar.txt
On Linux:
uuencode test_read_format_zip_encryption_data.zip \
test_read_format_zip_encryption_data.zip > \
test_read_format_zip_encryption_data.zip.uu
Partially encrypted archive ("foo.txt" is encrypted and "bar.txt" is not):
On Windows:
del /F test_read_format_zip_encryption_partially.zip
pkzipc.exe -add -cryptalgorithm=AES,256 -passphrase=12345678 test_read_format_zip_encryption_partially.zip foo.txt
pkzipc.exe -add test_read_format_zip_encryption_partially.zip bar.txt
On Linux:
uuencode test_read_format_zip_encryption_partially.zip \
test_read_format_zip_encryption_partially.zip > \
test_read_format_zip_encryption_partially.zip.uu
|
|
|
|
|
| |
This only implements seeking fully for uncompressed RAR files. Seeking is not
implemented for compressed RAR files and for the other formats (ZIP, TAR, etc.).
|
|
|
|
| |
to 'type2', possible lose of data.
|
|
|
|
| |
Properly set a clear error message when archive_{write,read}_set_options failed.
|
|
|
|
|
|
|
|
| |
Tell each bidder about the best bid so far so it can decide
to do nothing. Reorder support_format_all so formats
with relatively inexpensive bidders will run first.
SVN-Revision: 3822
|
|
|
|
| |
SVN-Revision: 3812
|
|
|
|
|
|
| |
alignment to read headers.
SVN-Revision: 3691
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
made with
libarchive 2.x in a wrong assumption of a wchar_t form in non UTF-8 locale;
use "tar:compat-2x" option instead.
And also add ""cpio:compat-2x" and "zip:compat-2x" to read filenames,
which are converted with CP_ACP, in those format on Windows plaform,
although you can use "hdrcharset=CP_ACP" option.
For posix like system:
- use "tar:compat-2x" option when you get incorrect filenames from pax
files made with bsdtar/libarchive 2.x.
For Windows system:
- use "tar:compat-2x", "cpio:compat-2x" and "zip:compat-2x" options
when you get incorrect filnames from those archives(except pax format)
made with bsdtar/libarchive 2.x.
SVN-Revision: 3403
|
|
|
|
|
|
| |
report the failure to the caller as much as we can instead of calling __archive_errx().
SVN-Revision: 3345
|
|
|
|
| |
SVN-Revision: 3300
|
|
|
|
| |
SVN-Revision: 3227
|
|
|
|
|
|
| |
record_hardlink() calls archive_set_error() itself
SVN-Revision: 3159
|
|
|
|
| |
SVN-Revision: 3133
|
|
|
|
|
|
| |
invoked, that data is no longer accessed
SVN-Revision: 2738
|
|
|
|
| |
SVN-Revision: 2694
|
|
|
|
| |
SVN-Revision: 2693
|
|
|
|
| |
SVN-Revision: 2434
|
|
|
|
| |
SVN-Revision: 2432
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Change __archive_check_magic to return a status code.
* Change callers to use the archive_check_magic() wrapper macro,
which calls __archive_check_magic and returns immediately
if there's an ARCHIVE_FATAL status.
* Update a bunch of API calls to actually do magic state checks.
I've also changed __archive_check_magic around a little bit:
* Magic number checks still call abort().
* State failures still call abort()
* Starting with libarchive 3.0, state failures will return ARCHIVE_FATAL.
SVN-Revision: 2003
|
|
|
|
| |
SVN-Revision: 1995
|
|
|
|
| |
SVN-Revision: 1971
|
|
|
|
| |
SVN-Revision: 1869
|
|
|
|
| |
SVN-Revision: 1786
|
|
|
|
|
|
| |
nlinks <= 1 when comparing dev/ino values. This seems to address Issue 54.
SVN-Revision: 1718
|
|
|
|
|
|
|
|
|
|
| |
searches forward for the next undamaged cpio header. This occurred
when the number of bytes returned by the next read operation happened
to be exactly the size of a cpio header. In this case, an off-by-one
error caused this code to decide that it didn't have enough bytes to
examine and then to loop around and ask for the exact same bytes again.
SVN-Revision: 1686
|
|
|
|
|
|
| |
This fixes some hardlink-detection issues on Windows: NTFS uses 64-bit inode values, but Windows ino_t is only 16 bits.
SVN-Revision: 1463
|
|
|
|
|
|
| |
nice to fill this in someday.
SVN-Revision: 1063
|
|
|
|
| |
SVN-Revision: 1061
|
|
|
|
|
|
|
| |
taking this into account led to a stack overwrite that broke
most of the new decompression code on this platform.
SVN-Revision: 539
|
|
|
|
| |
SVN-Revision: 491
|
|
|
|
| |
SVN-Revision: 268
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a more generic system of stackable stream transforms.
In particular, I believe I've edited every place that called the
decompressor directly to go through new __archive_read_ahead(),
__archive_read_consume() and __archive_read_skip() functions, so
the rest of the work here will not require any changes to the
format handlers.
I've also laid out the new types that will be needed for this.
Next step is to rewrite the decompressors to the new interface,
and overhaul the decompression auction to juggle generic "sources."
Then I'll be able to consolidate reblocking into a single place;
the transforms can emit arbitrary-sized blocks and the current
decompress_none logic will be used to reblock as needed by the
consumer format.
The initial impetus for this was to simplify the decompressors by
consolidating the reblocking logic. I recently came up with
some other transforms I'd like to implement (including new
decompressors, an encryption filter for secure backup, and
uudecode handling to simplify test harnesses) that would also
benefit from this. Eventually, I think I might be able to
standardize the interface for new transforms enough to allow
libarchive clients to register their own transforms complete
with bidding logic (the old interface was too wired into libarchive
internals for the API to be exported). In the very long term,
this might divorce the transformation logic from the rest of
libarchive enough to allow it to be packaged as an independent
library.
SVN-Revision: 234
|
|
|
|
| |
SVN-Revision: 225
|
|
SVN-Revision: 1
|