From 89a1fa831f466cb4c79f5e4ea1db36aa479a1355 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 22 Jun 2001 20:40:51 -0400 Subject: [PATCH] dirblock.c (ext2fs_read_dir_block): Remove use of dir_entry_2 since the byte-swapping code all assumes the ext2_dir_entry structure. (It's a question of whether or not name_len should be byte-swapped or not, and whether it's a 16 bit or 8 bit field.) --- lib/ext2fs/ChangeLog | 8 ++++++++ lib/ext2fs/dirblock.c | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 8ed3b06..c91b212 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,11 @@ +2001-06-22 Theodore Tso + + * dirblock.c (ext2fs_read_dir_block): Remove use of dir_entry_2 + since the byte-swapping code all assumes the + ext2_dir_entry structure. (It's a question of whether or + not name_len should be byte-swapped or not, and whether + it's a 16 bit or 8 bit field.) + 2001-06-15 Theodore Tso * Release of E2fsprogs 1.21 diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c index 846aebe..9efbceb 100644 --- a/lib/ext2fs/dirblock.c +++ b/lib/ext2fs/dirblock.c @@ -25,7 +25,6 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, errcode_t retval; char *p, *end; struct ext2_dir_entry *dirent; - struct ext2_dir_entry_2 *dirent2; unsigned int rec_len, do_swap; retval = io_channel_read_blk(fs->io, block, 1, buf); @@ -51,8 +50,7 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, rec_len = 8; retval = EXT2_ET_DIR_CORRUPTED; } - dirent2 = (struct ext2_dir_entry_2 *) dirent; - if ((dirent2->name_len +8) > dirent2->rec_len) + if (((dirent->name_len & 0xFF) + 8) > dirent->rec_len) retval = EXT2_ET_DIR_CORRUPTED; p += rec_len; } -- 1.8.3.1