dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0167-xfs-Fix-termination-loop-for-directory-iteration.patch

28f7f8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ecb9bb
From: Jan Kara <jack@suse.cz>
ecb9bb
Date: Mon, 14 Jul 2014 17:21:29 +0200
28f7f8
Subject: [PATCH] xfs: Fix termination loop for directory iteration
ecb9bb
ecb9bb
Directory iteration used wrong position (sizeof wrong structure) for
ecb9bb
termination of iteration inside a directory block. Luckily the position
ecb9bb
ended up being wrong by just 1 byte and directory entries are larger so
ecb9bb
things worked out fine in practice. But fix the problem anyway.
ecb9bb
ecb9bb
Signed-off-by: Jan Kara <jack@suse.cz>
ecb9bb
---
ecb9bb
 grub-core/fs/xfs.c | 3 +--
ecb9bb
 1 file changed, 1 insertion(+), 2 deletions(-)
ecb9bb
ecb9bb
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
28f7f8
index 16ffd3f1ebd..4bd52d1e081 100644
ecb9bb
--- a/grub-core/fs/xfs.c
ecb9bb
+++ b/grub-core/fs/xfs.c
ecb9bb
@@ -603,8 +603,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
ecb9bb
 		       - grub_be_to_cpu32 (tail->leaf_stale));
ecb9bb
 
ecb9bb
 	    /* Iterate over all entries within this block.  */
ecb9bb
-	    while (pos < (dirblk_size
ecb9bb
-			  - (int) sizeof (struct grub_xfs_dir2_entry)))
ecb9bb
+	    while (pos < tail_start)
ecb9bb
 	      {
ecb9bb
 		struct grub_xfs_dir2_entry *direntry;
ecb9bb
 		grub_uint8_t *freetag;