svn commit: r230307 - in head: lib/libfetch usr.bin/fetch
Pawel Jakub Dawidek
pjd at FreeBSD.org
Sat Jan 21 11:19:25 UTC 2012
On Wed, Jan 18, 2012 at 03:13:22PM +0000, Dag-Erling Smorgrav wrote:
> Author: des
> Date: Wed Jan 18 15:13:21 2012
> New Revision: 230307
> URL: http://svn.freebsd.org/changeset/base/230307
>
> Log:
> Fix two issues related to the use of SIGINFO in fetch(1) to display
> progress information. The first is that fetch_read() (used in the HTTP
> code but not the FTP code) can enter an infinite loop if it has previously
> been interrupted by a signal. The second is that when it is interrupted,
> fetch_read() will discard any data it may have read up to that point.
> Luckily, both bugs are extremely timing-sensitive and therefore difficult
> to trigger.
>
> PR: bin/153240
> Submitted by: Mark <markjdb at gmail.com>
> MFC after: 3 weeks
[...]
> +static int
> +fetch_cache_data(conn_t *conn, char *src, size_t nbytes)
> +{
> + char *tmp;
> +
> + if (conn->cache.size < nbytes) {
> + tmp = realloc(conn->cache.buf, nbytes);
> + if (tmp == NULL) {
> + errno = ENOMEM;
realloc(3) on failures sets errno to ENOMEM for you already.
> + conn->cache.len -= total;
> + conn->cache.pos += total;
> + len -= total;
> + buf+= total;
Style nit (missing space before +=).
--
Pawel Jakub Dawidek http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20120121/61c6259e/attachment.pgp
More information about the svn-src-head
mailing list