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:
Aurelien Jarno
2009-01-09 19:43:39 +00:00
committed by Blue Swirl
parent b323c13516
commit 709c8c466a

View File

@@ -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;