]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: only use override function when reading an 128 byte inode
authorTheodore Ts'o <tytso@mit.edu>
Mon, 22 Apr 2013 03:53:26 +0000 (23:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 22 Apr 2013 03:53:26 +0000 (23:53 -0400)
The ext2fs_read_inode_full() function should not use fs->read_inode()
if the caller has requested more than the base 128 byte inode
structure and the inode size is greater than 128 bytes.  Otherwise the
caller won't get all of the bytes that they were asking for, since
there's no way for the fs->read_inode override function can know what
the size of the buffer passed to ext2fs_read_inode_full().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/inode.c

index 77fc44761f120926fc42e5a872f538add0471b21..fd72d4cd8a8d7d5d756e986cad632fa199c2e17e 100644 (file)
@@ -533,7 +533,9 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
        /* Check to see if user has an override function */
-       if (fs->read_inode) {
+       if (fs->read_inode &&
+           ((bufsize == sizeof(struct ext2_inode)) ||
+            (EXT2_INODE_SIZE(fs->super) == sizeof(struct ext2_inode)))) {
                retval = (fs->read_inode)(fs, ino, inode);
                if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
                        return retval;