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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309523

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;
}