Brian Weaver [Wed, 26 Sep 2012 15:45:52 +0000 (11:45 -0400)]
Refactored common code into a single function
The tar_atol8() and tar_atol10() functions were essentially
identical. The code has been refactored to a common function
with tar_atol8() and tar_atol10() calling the commont function
with the radix instead duplicating the code.
The logic was also changed slightly to prevent a pointer
dereference when a zero length character array is passed to
the conversion routine.
Brian Weaver [Tue, 25 Sep 2012 13:51:12 +0000 (09:51 -0400)]
Add tighter checks to avoid reading past end of buffer
The string to base 8/10 conversion routines could read past the
counted end of the buffer if the string is correctly formated.
The number of characters is now checked and decremented for every
character that is consumed for processing.
Minor improvement in the mtree bidder.
- During checking NetBSD mtree -D format, if the first character of
the last filed in an entry line is '/', fail the test bidding mtree
format.
Brian Weaver [Tue, 25 Sep 2012 13:51:12 +0000 (09:51 -0400)]
Add tighter checks to avoid reading past end of buffer
The string to base 8/10 conversion routines could read past the
counted end of the buffer if the string is correctly formated.
The number of characters is now checked and decremented for every
character that is consumed for processing.
Andres Mejia [Wed, 19 Sep 2012 20:42:10 +0000 (16:42 -0400)]
Implement filtering of test cases run using glob pattern matching.
A test case will run if it matches a specified glob pattern. Test cases can
also be filtered out by including a '^' at the beginning of a pattern.
Fix a possibility of memory leaks when realloc fails.
Do not assign the return value of realloc into the variable that has
the original pointer because if realloc failed we will lose the chance
to release the address.
Fix a part of a commit 221f63f2f8.
The double free bug Clang Static Anlyzer(trunk) claimed of was the Clang's bug,
which is currently fixed, and it made a memory leak.
Allan McRae [Sat, 8 Sep 2012 08:59:33 +0000 (18:59 +1000)]
Fix mtree generation
When generating an mtree file, libarchive writes a "Relative" type (entries
that have no /) for files in the base directory. For directories, this causes
the mtree reader to change the parent directory and give subsequent files in
the root directory the wrong path.
Fix this by prefixing entries in the root directory with "./".
Tim Kientzle [Mon, 9 Apr 2012 05:06:43 +0000 (22:06 -0700)]
Resuscitate the old NFS4 support code and make it work on FreeBSD-CURRENT.
This includes a new test that archive_write_disk and archive_read_disk
consistently read/write ACL information to/from disk.
This new test currently passes on FreeBSD-CURRENT.
Avoid a warning that Clang Static Analyzer complained
"Access to field 'unconsumed' results in a dereference of a null
pointer (loaded from field 'entry_cfdata."
Dan McGee [Tue, 27 Mar 2012 22:22:40 +0000 (17:22 -0500)]
Fixes for GCC 4.7.0
Fixes the following compile error exposed with GCC 4.7.0:
libarchive/archive_string.c: In function 'cesu8_to_unicode':
libarchive/archive_string.c:2450:11: error: 'wc' may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
As well as a test failure that depends on signed integer wraparound,
which is a very bad thing to do in C [1]. Mark the intermediate result
as volatile to prevent the compiler optimizing away the arithmetic and
the logical test.
Dan McGee [Tue, 27 Mar 2012 22:06:32 +0000 (17:06 -0500)]
Fix segfault in iso9660 reader
Some odd ISO images do some funny things with RockRidge and Joliet data.
In this particular case, Joliet is used on the CD image, but the first
directory record has no RockRidge data. However, subsequent directory
entries (in the Joliet volume descriptor!) have RockRidge data attached,
although what is noticeably missing are type "NM" or name entries.
This causes seenRockridge to get flipped on, which makes the bad
assumption that seenJoliet is false. This means that when we reach the
code searching for the "rr_moved" special file, we strcmp() against NULL
because our filename is really in file->utf16be_bytes.
This is by far the easiest fix (and likely most correct fix) to this
madness; I have no idea whether a UTF-16 encoded "rr_moved" file can
even exist with whatever mastering software was used on this ISO.
Also note that if you explicitly disable Joliet processing, you get a
very different file listing on this ISO; apparently this is a cleaver
way to hide files from prying eyes in the Windows world: