]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
xfs: Fix termination loop for directory iteration
authorJan Kara <jack@suse.cz>
Mon, 14 Jul 2014 15:21:29 +0000 (17:21 +0200)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Mon, 11 May 2015 11:48:14 +0000 (14:48 +0300)
Directory iteration used wrong position (sizeof wrong structure) for
termination of iteration inside a directory block. Luckily the position
ended up being wrong by just 1 byte and directory entries are larger so
things worked out fine in practice. But fix the problem anyway.

Signed-off-by: Jan Kara <jack@suse.cz>
grub-core/fs/xfs.c

index 16ffd3f1ebd97f3fe6bd4b93fc1ec97d0c06f216..4bd52d1e081d4f2b23585733641faac06a9c35d1 100644 (file)
@@ -603,8 +603,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
                       - grub_be_to_cpu32 (tail->leaf_stale));
 
            /* Iterate over all entries within this block.  */
-           while (pos < (dirblk_size
-                         - (int) sizeof (struct grub_xfs_dir2_entry)))
+           while (pos < tail_start)
              {
                struct grub_xfs_dir2_entry *direntry;
                grub_uint8_t *freetag;