diff --git a/src/pxar/decoder.rs b/src/pxar/decoder.rs index aca74935..9db26e21 100644 --- a/src/pxar/decoder.rs +++ b/src/pxar/decoder.rs @@ -371,8 +371,13 @@ impl Result<(), Error>> Decoder { /// Read the target of a hardlink in the archive. pub fn read_link(&mut self, offset: u64) -> Result<(PathBuf, PxarEntry), Error> { self.seek(SeekFrom::Start(offset))?; - let mut header: PxarHeader = self.inner.read_item()?; + if header.htype != PXAR_FILENAME { + bail!("Expected PXAR_FILENAME, encountered 0x{:x?}", header.htype); + } + let _filename = self.inner.read_filename(header.size)?; + + header = self.inner.read_item()?; check_ca_header::(&header, PXAR_ENTRY)?; let entry: PxarEntry = self.inner.read_item()?;