Relax sanity check of number fields in tar header even more.

This fixes reading tar archives created by older versions of
plexus-archiver (used by maven-assembly-plugin) that fill uid and gid
fields with spaces (PLXCOMP-233).

Vendor issue:
https://github.com/libarchive/libarchive/issues/832

Reported by:	Antoine Brodin <antoine@freebsd.org>
MFC after:	1 week
This commit is contained in:
Martin Matuska 2016-12-04 02:58:13 +00:00
parent aa38c69b74
commit 43d91c021f

View File

@ -324,11 +324,7 @@ validate_number_field(const char* p_field, size_t i_size)
while (i < i_size && p_field[i] == ' ') {
++i;
}
/* Must be at least one octal digit. */
if (i >= i_size || p_field[i] < '0' || p_field[i] > '7') {
return 0;
}
/* Skip remaining octal digits. */
/* Skip octal digits. */
while (i < i_size && p_field[i] >= '0' && p_field[i] <= '7') {
++i;
}