Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a4ec2b
)
ext2fs_read_inode_full: Add safety check to avoid SEGV's on corrupted fs's
author
Theodore Ts'o
<tytso@mit.edu>
Tue, 20 Jan 2009 04:09:37 +0000
(23:09 -0500)
committer
Theodore Ts'o
<tytso@mit.edu>
Tue, 20 Jan 2009 04:09:37 +0000
(23:09 -0500)
Thanks to Thiemo Nagel for suggesting this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/inode.c
patch
|
blob
|
history
diff --git
a/lib/ext2fs/inode.c
b/lib/ext2fs/inode.c
index
b3ac9f2
..
f9cc43c
100644
(file)
--- a/
lib/ext2fs/inode.c
+++ b/
lib/ext2fs/inode.c
@@
-564,6
+564,8
@@
errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
io = fs->image_io;
} else {
group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
+ if (group > fs->group_desc_count)
+ return EXT2_ET_BAD_INODE_NUM;
offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
EXT2_INODE_SIZE(fs->super);
block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super);