提交 28d7b568 编写于 作者: D Dan Carpenter 提交者: Phillip Lougher

Squashfs: sanity check information from disk

We read the size of the name from the disk, but a larger name than
expected would cause memory corruption.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NPhillip Lougher <phillip@squashfs.org.uk>
上级 d8dfad38
......@@ -79,7 +79,8 @@ static int get_dir_index_using_name(struct super_block *sb,
int len)
{
struct squashfs_sb_info *msblk = sb->s_fs_info;
int i, size, length = 0, err;
int i, length = 0, err;
unsigned int size;
struct squashfs_dir_index *index;
char *str;
......@@ -103,6 +104,10 @@ static int get_dir_index_using_name(struct super_block *sb,
size = le32_to_cpu(index->size) + 1;
if (size > SQUASHFS_NAME_LEN) {
err = -EINVAL;
break;
}
err = squashfs_read_metadata(sb, index->name, &index_start,
&index_offset, size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册