Skip to content

Commit 8ed1c5c

Browse files
Fix list panic when last block of the filesystem is used
1 parent 53bbcd4 commit 8ed1c5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl Storage for FileStorage {
7979
const BLOCK_COUNT: usize = BLOCK_COUNT;
8080

8181
fn read(&mut self, off: usize, buf: &mut [u8]) -> Result<usize> {
82-
assert!(off + buf.len() < BLOCK_SIZE * BLOCK_COUNT);
82+
assert!(off + buf.len() <= BLOCK_SIZE * BLOCK_COUNT);
8383
if off >= self.len {
8484
// blocks that are not in the file are assumed to be empty
8585
buf.iter_mut().for_each(|byte| *byte = 0);

0 commit comments

Comments
 (0)