Skip to content

Commit

Permalink
Squashfs: fix corruption checks in squashfs_lookup()
Browse files Browse the repository at this point in the history
The dir_count and size fields when read from disk are sanity
checked for correctness.  However, the sanity checks only check the
values are not greater than expected.  As dir_count and size were
incorrectly defined as signed ints, this can lead to corrupted values
appearing as negative which are not trapped.

Signed-off-by: Phillip Lougher <[email protected]>
  • Loading branch information
plougher committed Sep 6, 2013
1 parent 9dbc41d commit 52e9ce1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/squashfs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
struct squashfs_dir_entry *dire;
u64 block = squashfs_i(dir)->start + msblk->directory_table;
int offset = squashfs_i(dir)->offset;
int err, length, dir_count, size;
int err, length;
unsigned int dir_count, size;

TRACE("Entered squashfs_lookup [%llx:%x]\n", block, offset);

Expand Down

0 comments on commit 52e9ce1

Please sign in to comment.