From: Martin Matuska Date: Mon, 5 Dec 2016 15:24:54 +0000 (+0100) Subject: Add more explanation comments to validate_number_field() X-Git-Tag: v3.3.0~101^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddb3954bfdb9a0a98d50fb1c50cbecb603d9adf0;p=thirdparty%2Flibarchive.git Add more explanation comments to validate_number_field() --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index b3db34d78..6febc2dd2 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -299,14 +299,21 @@ archive_read_format_tar_cleanup(struct archive_read *a) * * This has to be pretty lenient in order to accomodate the enormous * variety of tar writers in the world: - * = POSIX ustar requires octal values with leading zeros and - * specific termination on fields + * = POSIX (IEEE Std 1003.1-1988) ustar requires octal values with leading + * zeros and allows fields to be terminated with space or null characters * = Many writers use different termination (in particular, libarchive * omits terminator bytes to squeeze one or two more digits) * = Many writers pad with space and omit leading zeros * = GNU tar and star write base-256 values if numbers are too * big to be represented in octal * + * Examples of specific tar headers that we should support: + * = Perl Archive::Tar terminates uid, gid, devminor and devmajor with two + * null bytes, pads size with spaces and other numeric fields with zeroes + * = plexus-archiver prior to 2.6.3 (before switching to commons-compress) + * may have uid and gid fields filled with spaces without any octal digits + * at all and pads all numeric fields with spaces + * * This should tolerate all variants in use. It will reject a field * where the writer just left garbage after a trailing NUL. */