mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
grubfs: don't try to read a file beyond its end
Yaboot relies on the read function from openbios to stop reading at the
end of a file. This patch makes sure to not read beyond the end of the
file. This fixes the boot of debian-installer using a CD-ROM.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://coreboot.org/openbios/openbios-devel@373 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Blue Swirl
parent
b323c13516
commit
709c8c466a
@@ -161,6 +161,9 @@ grubfs_file_read( file_desc_t *fd, void *buf, size_t count )
|
||||
filepos=file->pos;
|
||||
filemax=file->len;
|
||||
|
||||
if (count > filemax - filepos)
|
||||
count = filemax - filepos;
|
||||
|
||||
ret=curfs->fsys->read_func(buf, count);
|
||||
|
||||
file->pos=filepos;
|
||||
|
||||
Reference in New Issue
Block a user