dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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