src/pxar/decoder.rs: correctly read, check and skip filename

The previous implementation simply skipped over `size` bytes, which is not
correct as size includes also the header.
By relying on `SequentailDecoder`s read_filename function, this is correctly
taken care of plus some more integrity checks.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-09-09 18:27:21 +02:00 committed by Dietmar Maurer
parent 4a7de56e2f
commit ac30bc3326
1 changed files with 1 additions and 1 deletions

View File

@ -305,7 +305,7 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
if marker == PXAR_FILENAME {
let size: u64 = self.inner.read_item()?;
let _bytes = self.inner.skip_bytes(usize::try_from(size)?)?;
let _filename = self.inner.read_filename(size)?;
marker = self.inner.read_item()?;
}
if marker != PXAR_ENTRY {