diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-04-14 22:54:21 -0400 |
---|---|---|
committer | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-04-14 22:54:21 -0400 |
commit | 3ec10cd8b526c6b10170c2649002672ee2019e73 (patch) | |
tree | 27e3fb26020877ae43d3bcc5996c058957df3dc3 /fs/squashfs/dir.c | |
parent | 993916203f00e8c62599466a5caa866e09f0fae3 (diff) | |
parent | 1be99f6c95e6c887756f789a60d15771235acd0c (diff) |
Merge commit 'v2.6.38.3' into linaro-2.6.38
Diffstat (limited to 'fs/squashfs/dir.c')
-rw-r--r-- | fs/squashfs/dir.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c index 0dc340aa2be..3f79cd1d0c1 100644 --- a/fs/squashfs/dir.c +++ b/fs/squashfs/dir.c @@ -172,6 +172,11 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) length += sizeof(dirh); dir_count = le32_to_cpu(dirh.count) + 1; + + /* dir_count should never be larger than 256 */ + if (dir_count > 256) + goto failed_read; + while (dir_count--) { /* * Read directory entry. @@ -183,6 +188,10 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) size = le16_to_cpu(dire->size) + 1; + /* size should never be larger than SQUASHFS_NAME_LEN */ + if (size > SQUASHFS_NAME_LEN) + goto failed_read; + err = squashfs_read_metadata(inode->i_sb, dire->name, &block, &offset, size); if (err < 0) |