Skip to content

Commit

Permalink
Prevent self referential dir
Browse files Browse the repository at this point in the history
* Found by fuzzer, prevent stack overflow of a self referential dir
  • Loading branch information
wcampbell0x2a committed Dec 1, 2024
1 parent 97d5a08 commit c5a7b5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backhand/src/squashfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,12 @@ impl<'b> Squashfs<'b> {
// BasicDirectory, ExtendedDirectory
InodeId::BasicDirectory | InodeId::ExtendedDirectory => {
// its a dir, extract all children inodes
if *found_inode == dir_inode {
error!("self referential dir to already read inode");
return Err(BackhandError::UnexpectedInode(
dir_inode.inner.clone(),
));
}
self.extract_dir(fullpath, root, found_inode, &self.id)?;
InnerNode::Dir(SquashfsDir::default())
}
Expand Down

0 comments on commit c5a7b5f

Please sign in to comment.