mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 23:59:22 +00:00
grub-core/fs/minix.c (grub_minix_read_file): Avoid reading past the end of file.
This commit is contained in:
1 parent
af435524cd
commit
30e177a05b
3 files changed
+18
-1
No files matched your search
@@ -262,6 +262,13 @@ grub_minix_read_file (struct grub_minix_data *data,
|
||||
grub_uint32_t posblock;
|
||||
grub_uint32_t blockoff;
|
||||
|
||||
if (pos > GRUB_MINIX_INODE_SIZE (data))
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
N_("attempt to read past the end of file"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Adjust len so it we can't read past the end of the file. */
|
||||
if (len + pos > GRUB_MINIX_INODE_SIZE (data))
|
||||
len = GRUB_MINIX_INODE_SIZE (data) - pos;
|
||||
|
||||
Reference in new issue
Block a user