[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search
From: |
t . feng |
Subject: |
[PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search |
Date: |
Sat, 19 Nov 2022 18:39:43 +0800 |
Fix memory leak in grub_hfsplus_btree_search.
Fixes: 58ea11d5b(Don't fetch a key beyond the end of the node)
Signed-off-by: "t.feng" <fengtao40@huawei.com>
---
grub-core/fs/hfsplus.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
index 6337cbfcb..11393ca34 100644
--- a/grub-core/fs/hfsplus.c
+++ b/grub-core/fs/hfsplus.c
@@ -652,7 +652,10 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree
*btree,
+ 2);
if ((char *) pointer > node + btree->nodesize - 2)
- return grub_error (GRUB_ERR_BAD_FS, "HFS+ key beyond end of
node");
+ {
+ grub_free (node);
+ return grub_error (GRUB_ERR_BAD_FS, "HFS+ key beyond end of
node");
+ }
currnode = grub_be_to_cpu32 (grub_get_unaligned32 (pointer));
match = 1;
--
2.27.0
- [PATCH 0/9] fix memory leaks in fs module, t . feng, 2022/11/19
- [PATCH 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate, t . feng, 2022/11/19
- [PATCH 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink, t . feng, 2022/11/19
- [PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search,
t . feng <=
- [PATCH 2/9] fs/btrfs: Fix memory leak in find_path, t . feng, 2022/11/19
- [PATCH 1/9] fs/affs:Fix memory leaks in grub_affs_create_node, t . feng, 2022/11/19
- [PATCH 9/9] fs/xfs: Fix memory leaks in xfs, t . feng, 2022/11/19
- [PATCH 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir, t . feng, 2022/11/19
- [PATCH 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink, t . feng, 2022/11/19
- [PATCH 5/9] fs/bfs: Fix memory leak in read_bfs_file, t . feng, 2022/11/19
- Re: [PATCH 0/9] fix memory leaks in fs module, Daniel Kiper, 2022/11/23