On 08/03/10 17:00, Giuseppe Scrivano wrote:

> +      if (alloc_off -  (off_t) (size_t) alloc_off
> +          || (size_t) alloc_off + 1 < (size_t) alloc_off)
> +        break;

It would be clearer without the casts.  (Casts are often
overkill in C; they disable too much checking.)  Also, I'm still
dubious about going ahead with a file that's too
large to fit into memory.  Better and clearer would be
something like this:

  if (SIZE_MAX <= alloc_off)
    {
      errno = ENOMEM;
      return NULL;
    }

Reply via email to