summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/common.h
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2012-01-18 15:13:21 +0000
committerdes <des@FreeBSD.org>2012-01-18 15:13:21 +0000
commit939a66af62dc031d0ca35b5e7b1410f8aedc1d7c (patch)
treea2005365ba56694fd925cd9d8f2687ea003a376f /lib/libfetch/common.h
parent7972e45b2052402d891e3dd144472547dac25ec6 (diff)
downloadFreeBSD-src-939a66af62dc031d0ca35b5e7b1410f8aedc1d7c.zip
FreeBSD-src-939a66af62dc031d0ca35b5e7b1410f8aedc1d7c.tar.gz
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@gmail.com> MFC after: 3 weeks
Diffstat (limited to 'lib/libfetch/common.h')
-rw-r--r--lib/libfetch/common.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libfetch/common.h b/lib/libfetch/common.h
index 35e0dfd..241dbbf 100644
--- a/lib/libfetch/common.h
+++ b/lib/libfetch/common.h
@@ -52,6 +52,13 @@ struct fetchconn {
size_t bufsize; /* buffer size */
size_t buflen; /* length of buffer contents */
int err; /* last protocol reply code */
+ struct { /* data cached after an interrupted
+ read */
+ char *buf;
+ size_t size;
+ size_t pos;
+ size_t len;
+ } cache;
#ifdef WITH_SSL
SSL *ssl; /* SSL handle */
SSL_CTX *ssl_ctx; /* SSL context */
OpenPOWER on IntegriCloud