nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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