Skip to content

Commit

Permalink
Merge pull request #283 from wcampbell0x2a/282-increase-dir-path-length
Browse files Browse the repository at this point in the history
backhand: Increase DirectoryIndex::name_size length
  • Loading branch information
wcampbell0x2a authored Oct 25, 2023
2 parents 2757cdb + 3363bd8 commit ea7aefb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Bug Fix
- When creating an empty image using `FilesystemWriter::default()`, correctly create the ID table for UID and GID entries. Reported: ([@hwittenborn](https://github.com/hwittenborn)) ([!250](https://github.com/wcampbell0x2a/backhand/issues/275)), Fixed: ([#275](https://github.com/wcampbell0x2a/backhand/pull/275))
- Remove manual `Clone` impl for `FilesystemReaderFile` ([#277](https://github.com/wcampbell0x2a/backhand/pull/277))
- Increase `DirectoryIndex::name_size` length from 100 to 255. ([@eatradish](https://github.com/eatradish)) ([!282](https://github.com/wcampbell0x2a/backhand/issues/282)), Fixed: ([#283](https://github.com/wcampbell0x2a/backhand/pull/283))

## Security
- Only allow root and simple filenames into `DirEntry`([@rbran](https://github.com/rbran)) ([#271](https://github.com/wcampbell0x2a/backhand/pull/271))
Expand Down
2 changes: 1 addition & 1 deletion src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub struct DirectoryIndex {
pub(crate) index: u32,
/// Start offset of a directory table metadata block, relative to the directory table start.
pub(crate) start: u32,
#[deku(assert = "*name_size < 100")]
#[deku(assert = "*name_size < 256")]
pub(crate) name_size: u32,
#[deku(count = "*name_size + 1")]
pub(crate) name: Vec<u8>,
Expand Down
11 changes: 8 additions & 3 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,14 @@ pub trait SquashFsReader: BufReadSeek {
ret_vec.insert(inode.header.inode_number, inode);
input_bits = rest;
}
Err(_) => {
// try next block, inodes can span multiple blocks!
break;
Err(e) => {
if let DekuError::Incomplete(_) = e {
// try next block, inodes can span multiple blocks!
break;
} else {
error!("{e}");
return Err(BackhandError::Deku(e));
}
}
}
}
Expand Down

0 comments on commit ea7aefb

Please sign in to comment.