[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] f2fs: fix off-by-one error in nat journal entries check
From: |
Daniel Axtens |
Subject: |
[PATCH] f2fs: fix off-by-one error in nat journal entries check |
Date: |
Sun, 15 Jan 2023 00:19:50 +1100 |
Oops. You're allowed to have up to n = NAT_JOURNAL_ENTRIES entries
_inclusive_, because the loop below uses i < n, not i <= n. D'oh.
Fixes: 4bd9877f6216 ("fs/f2fs: Do not read past the end of nat journal entries")
Reported-by: программист нект <programmer11180@programist.ru>
Tested-by: программист нект <programmer11180@programist.ru>
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
grub-core/fs/f2fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grub-core/fs/f2fs.c b/grub-core/fs/f2fs.c
index df6beb544cbd..855e24618c2b 100644
--- a/grub-core/fs/f2fs.c
+++ b/grub-core/fs/f2fs.c
@@ -650,7 +650,7 @@ get_blkaddr_from_nat_journal (struct grub_f2fs_data *data,
grub_uint32_t nid,
grub_uint16_t n = grub_le_to_cpu16 (data->nat_j.n_nats);
grub_uint16_t i;
- if (n >= NAT_JOURNAL_ENTRIES)
+ if (n > NAT_JOURNAL_ENTRIES)
return grub_error (GRUB_ERR_BAD_FS,
"invalid number of nat journal entries");
--
2.25.1
- [PATCH] f2fs: fix off-by-one error in nat journal entries check,
Daniel Axtens <=