From: Kalpak Shah Date: Sat, 30 Jun 2007 01:40:19 +0000 (-0400) Subject: Fix byte swapping bug in get_next_inode_full() X-Git-Tag: E2FSPROGS-1_40~2 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1ed49d2c2ab7fdb02158d5feeb86288ece7eb17c;p=tools%2Fe2fsprogs.git Fix byte swapping bug in get_next_inode_full() On big-endian systems, while swapping, ext2fs_swap_inode_full() swaps only 128+extra_isize bytes and the EAs if they are present. Now if inode N has EAs, (and this is the inode in the "scratch inode") then inode N+1 also carries seems to have them since the "scratch inode" was never zeroed. Signed-off-by: Kalpak Shah Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index f7ef59d..08a1689 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,10 @@ +2007-06-29 Theodore Tso + + * inode.c (ext2fs_get_next_inode_full): Whe byte swapping, make + sure the inode buffer is cleared first so that the + previous contents don't get mistaken as part of the new + (next) inode. + 2006-06-24 Theodore Ts'o * Release of E2fsprogs 1.40 diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c index 03d1be0..49d012c 100644 --- a/lib/ext2fs/inode.c +++ b/lib/ext2fs/inode.c @@ -454,6 +454,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, scan->bytes_left -= scan->inode_size - extra_bytes; #ifdef EXT2FS_ENABLE_SWAPFS + memset(inode, 0, bufsize); if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) ext2fs_swap_inode_full(scan->fs, @@ -468,6 +469,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, scan->scan_flags &= ~EXT2_SF_BAD_EXTRA_BYTES; } else { #ifdef EXT2FS_ENABLE_SWAPFS + memset(inode, 0, bufsize); if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) ext2fs_swap_inode_full(scan->fs,