[patch] Fix BZ 19165 -- overflow in fread / fwrite
Andreas Schwab
schwab@suse.de
Mon Oct 26 09:09:00 GMT 2015
Paul Pluzhnikov <ppluzhnikov@google.com> writes:
> diff --git a/libio/iofread.c b/libio/iofread.c
> index eb69b05..a8ea391 100644
> --- a/libio/iofread.c
> +++ b/libio/iofread.c
> @@ -37,7 +37,7 @@ _IO_fread (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp)
> _IO_acquire_lock (fp);
> bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
> _IO_release_lock (fp);
> - return bytes_requested == bytes_read ? count : bytes_read / size;
> + return bytes_read / size;
> }
> libc_hidden_def (_IO_fread)
>
Please add a comment why we ignore overflow here.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list