e2fsprogs/e2fsprogs-1.40.8-fix_ext2fs_swap_inode_full.patch

27 lines
899 B
Diff

diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 6576c59..e07e87c 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -133,7 +133,7 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
struct ext2_inode_large *f, int hostorder,
int bufsize)
{
- unsigned i, has_data_blocks, extra_isize;
+ unsigned i, has_data_blocks, extra_isize, attr_magic;
int islnk = 0;
__u32 *eaf, *eat;
@@ -232,7 +232,11 @@ void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
eaf = (__u32 *) (((char *) f) + sizeof(struct ext2_inode) +
extra_isize);
- if (ext2fs_swab32(*eaf) != EXT2_EXT_ATTR_MAGIC)
+ attr_magic = *eaf;
+ if (!hostorder)
+ attr_magic = ext2fs_swab32(attr_magic);
+
+ if (attr_magic != EXT2_EXT_ATTR_MAGIC)
return; /* it seems no magic here */
eat = (__u32 *) (((char *) t) + sizeof(struct ext2_inode) +