Whamcloud - gitweb
ChangeLog, dir_iterate.c:
authorTheodore Ts'o <tytso@mit.edu>
Tue, 1 May 2001 19:04:28 +0000 (19:04 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 1 May 2001 19:04:28 +0000 (19:04 +0000)
  dir_iterate.c (ext2fs_process_dir_block): Add a double-check to make
   sure the rec_len is a multiple of 4, to prevent bus-errors on
   architectures which care about mis-aligned pointer references.

lib/ext2fs/ChangeLog
lib/ext2fs/dir_iterate.c

index 264f42f..26bde10 100644 (file)
@@ -1,3 +1,10 @@
+2001-05-01  Theodore Tso  <tytso@valinux.com>
+
+       * dir_iterate.c (ext2fs_process_dir_block): Add a double-check to
+               make sure the rec_len is a multiple of 4, to prevent
+               bus-errors on architectures which care about mis-aligned
+               pointer references.
+
 2001-04-25  Theodore Tso  <tytso@valinux.com>
 
        * getsize.c (ext2fs_get_device_size): Use an unsigned long to
index 2f07345..c47d1e6 100644 (file)
@@ -100,6 +100,7 @@ int ext2fs_process_dir_block(ext2_filsys    fs,
                dirent = (struct ext2_dir_entry *) (ctx->buf + offset);
                if (((offset + dirent->rec_len) > fs->blocksize) ||
                    (dirent->rec_len < 8) ||
+                   ((dirent->rec_len % 4) != 0) ||
                    (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) {
                        ctx->errcode = EXT2_ET_DIR_CORRUPTED;
                        return BLOCK_ABORT;