Whamcloud - gitweb
ChangeLog, dirblock.c:
authorTheodore Ts'o <tytso@mit.edu>
Fri, 5 Jan 2001 22:27:06 +0000 (22:27 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 5 Jan 2001 22:27:06 +0000 (22:27 +0000)
  dirblock.c (ext2fs_read_dir_block): Fix a potential case where we may
   overrun allocated memory in case of a corrupted filesystem (or an
   e2fsck test case :-) when byte-swapping the directory block.

lib/ext2fs/ChangeLog
lib/ext2fs/dirblock.c

index 7675edb..ad38026 100644 (file)
@@ -1,5 +1,10 @@
 2001-01-05    <tytso@snap.thunk.org>
 
+       * dirblock.c (ext2fs_read_dir_block): Fix a potential case where
+               we may overrun allocated memory in case of a corrupted
+               filesystem (or an e2fsck test case :-) when byte-swapping
+               the directory block.
+
        * ext2fs.h: Indent the #warning to fix gcc -Wall complaint.
 
        * mkjournal.c (ext2fs_add_journal_device): Fix various gcc -Wall
index 14c2f36..cb274b7 100644 (file)
@@ -39,7 +39,7 @@ errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
                return 0;
        p = (char *) buf;
        end = (char *) buf + fs->blocksize;
-       while (p < end) {
+       while (p < end-8) {
                dirent = (struct ext2_dir_entry *) p;
                dirent->inode = ext2fs_swab32(dirent->inode);
                dirent->rec_len = ext2fs_swab16(dirent->rec_len);