On Fri, Aug 14, 2009 at 07:48:40PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> diff --git a/kern/file.c b/kern/file.c
> index 9b56b88..85092b8 100644
> --- a/kern/file.c
> +++ b/kern/file.c
> @@ -112,6 +112,12 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t 
> len)
>  {
>    grub_ssize_t res;
>  
> +  if (file->offset > file->size)
> +    {
> +      grub_error (GRUB_ERR_OUT_OF_RANGE, "Bad offset");
> +      return -1;
> +    }

This could be a bit more descriptive (e.g. "Offset exceeds file size"), maybe
even indicate the sizes and/or filename.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to