diff options
Diffstat (limited to 'block/curl.c')
-rw-r--r-- | block/curl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block/curl.c b/block/curl.c index 3494c6d662..1b9b1f6341 100644 --- a/block/curl.c +++ b/block/curl.c @@ -157,6 +157,11 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque) if (!s || !s->orig_buf) goto read_end; + if (s->buf_off >= s->buf_len) { + /* buffer full, read nothing */ + return 0; + } + realsize = MIN(realsize, s->buf_len - s->buf_off); memcpy(s->orig_buf + s->buf_off, ptr, realsize); s->buf_off += realsize; |