Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The tar header format does not have a "magic" number at the start, so in general it is impossible to tell if an input file is a tar file without reading a lot more data.
The current match() implementation assumes the first 8 bytes contain "test1.xml", which is obviously a hack for testing purposes.
If more bytes are read from the input, it might be possible to implement a working match() method:
The file must be at least 512 bytes long.
The following offsets have contents that could be checked:
Offset len
148 8 Checksum for header block
156 1 Link indicator (file type) - '0'-'6' or null
Other possible checks are:
- numeric fields must be octal
- filename fields must end in trailing nulls (but can a filename contain a null?)