f2fs: fix off-by-one error in nat journal entries check
PATCH 1/1 f2fs: fix off-by-one error in nat journal entries check
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 программист нект <[email protected]>
Tested-by программист нект <[email protected]>
Signed-off-by Daniel Axtens <[email protected]>
--- grub-core/fs/f2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/fs/f2fs.c +1 -1
@@ -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" );
Signature · 1 line
2.25.1
Quoted 7 lines · Daniel Axtens
Oops. You're allowed to have up to n =
NAT_JOURNAL_ENTRIESentries _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 программист нект <[email protected]>Tested-by программист нект <[email protected]>Signed-off-by Daniel Axtens <[email protected]>
Reviewed-by Daniel Kiper <[email protected]>
Daniel