On 08/03/10 13:05, Giuseppe Scrivano wrote:
> +      long pos = ftell (stream);

This isn't reliable on modern 32-bit hosts.  Please use
ftello rather than ftell, as ftell is obsolete.  You'll
need to alter the module to depend on the ftello module.

> +      alloc = st.st_size - pos + 1;

The assignment could overflow, since off_t might be
wider than size_t.  This must be checked for. and
errno should be set to ENOMEM if overflow occurs.

Also, the "+ 1" could overflow; this should be checked
for too, preferably by doing + 1 in size_t rather than
off_t (as signed overflow is problematic).

Reply via email to