grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFT, PATCH] Fix file->offset handling


From: Robert Millan
Subject: Re: [RFT, PATCH] Fix file->offset handling
Date: Mon, 17 Aug 2009 15:34:58 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]