From 709c8c466afcffa9025b76b268d7795c3717f05d Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 9 Jan 2009 19:43:39 +0000 Subject: [PATCH] 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 git-svn-id: svn://coreboot.org/openbios/openbios-devel@373 f158a5a8-5612-0410-a976-696ce0be7e32 --- fs/grubfs/grubfs_fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/grubfs/grubfs_fs.c b/fs/grubfs/grubfs_fs.c index f172b75..588d677 100644 --- a/fs/grubfs/grubfs_fs.c +++ b/fs/grubfs/grubfs_fs.c @@ -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;