src/pxar/decoder.rs: fix bug in decoder read
`offset` points to the `PXAR_FILENAME`, therefore read the filename before the `PXAR_ENTRY`. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
2aba16bde1
commit
1c93182371
|
@ -345,6 +345,11 @@ impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
|
|||
/// returned.
|
||||
pub fn read(&mut self, offset: u64, size: usize, data_offset: u64) -> Result<Vec<u8>, Error> {
|
||||
self.seek(SeekFrom::Start(offset))?;
|
||||
let head: PxarHeader = self.inner.read_item()?;
|
||||
if head.htype != PXAR_FILENAME {
|
||||
bail!("Expected PXAR_FILENAME, encountered 0x{:x?}", head.htype);
|
||||
}
|
||||
let _filename = self.inner.read_filename(head.size)?;
|
||||
|
||||
let head: PxarHeader = self.inner.read_item()?;
|
||||
check_ca_header::<PxarEntry>(&head, PXAR_ENTRY)?;
|
||||
|
|
Loading…
Reference in New Issue