[OpenBIOS] r373 - openbios-devel/fs/grubfs

svn at openbios.org svn at openbios.org
Fri Jan 9 20:43:39 CET 2009


Author: blueswirl
Date: 2009-01-09 20:43:39 +0100 (Fri, 09 Jan 2009)
New Revision: 373

Modified:
   openbios-devel/fs/grubfs/grubfs_fs.c
Log:
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 at aurel32.net>


Modified: openbios-devel/fs/grubfs/grubfs_fs.c
===================================================================
--- openbios-devel/fs/grubfs/grubfs_fs.c	2009-01-08 15:14:33 UTC (rev 372)
+++ openbios-devel/fs/grubfs/grubfs_fs.c	2009-01-09 19:43:39 UTC (rev 373)
@@ -161,6 +161,9 @@
 	filepos=file->pos;
 	filemax=file->len;
 
+	if (count > filemax - filepos)
+		count = filemax - filepos;
+
 	ret=curfs->fsys->read_func(buf, count);
 
 	file->pos=filepos;




More information about the OpenBIOS mailing list