nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

ecb9bb
From 6afb93f24d48ff10d4266396b079b79033e05b0a Mon Sep 17 00:00:00 2001
ecb9bb
From: Jan Kara <jack@suse.cz>
ecb9bb
Date: Mon, 14 Jul 2014 17:21:29 +0200
27a4da
Subject: [PATCH 167/260] 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
27a4da
index 16ffd3f1e..4bd52d1e0 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;
ecb9bb
-- 
27a4da
2.13.0
ecb9bb