Whamcloud - gitweb
dirblock.c (ext2fs_read_dir_block): Remove use of dir_entry_2 since
authorTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2001 00:40:51 +0000 (20:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2001 00:40:51 +0000 (20:40 -0400)
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
lib/ext2fs/dirblock.c

index 8ed3b06..c91b212 100644 (file)
@@ -1,3 +1,11 @@
+2001-06-22  Theodore Tso  <tytso@valinux.com>
+
+       * 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  <tytso@valinux.com>
 
        * Release of E2fsprogs 1.21
index 846aebe..9efbceb 100644 (file)
@@ -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;
        }