|
|
05bba0 |
From 331b54ab7f261fd24844f7345aaaad03ef474e7e Mon Sep 17 00:00:00 2001
|
|
|
05bba0 |
From: Richard Jones <rjones@redhat.com>
|
|
|
05bba0 |
Date: Thu, 11 Jun 2015 11:40:11 +0200
|
|
|
05bba0 |
Subject: [PATCH 11/30] curl: Fix return from curl_read_cb with invalid state
|
|
|
05bba0 |
|
|
|
05bba0 |
Message-id: <1434022828-13037-5-git-send-email-rjones@redhat.com>
|
|
|
05bba0 |
Patchwork-id: 65839
|
|
|
05bba0 |
O-Subject: [RHEL-7.2 qemu-kvm v3 PATCH 04/21] curl: Fix return from curl_read_cb with invalid state
|
|
|
05bba0 |
Bugzilla: 1226684
|
|
|
05bba0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
05bba0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
05bba0 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
05bba0 |
|
|
|
05bba0 |
From: Matthew Booth <mbooth@redhat.com>
|
|
|
05bba0 |
|
|
|
05bba0 |
A curl write callback is supposed to return the number of bytes it
|
|
|
05bba0 |
handled. curl_read_cb would have erroneously reported it had handled
|
|
|
05bba0 |
all bytes in the event that the internal curl state was invalid.
|
|
|
05bba0 |
|
|
|
05bba0 |
Signed-off-by: Matthew Booth <mbooth@redhat.com>
|
|
|
05bba0 |
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
05bba0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
05bba0 |
|
|
|
05bba0 |
Upstream-status: 38bbc0a580f9f10570b1d1b5d3e92f0e6feb2970
|
|
|
05bba0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
05bba0 |
---
|
|
|
05bba0 |
block/curl.c | 3 +--
|
|
|
05bba0 |
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
05bba0 |
|
|
|
05bba0 |
diff --git a/block/curl.c b/block/curl.c
|
|
|
05bba0 |
index d399e3a..8c707e1 100644
|
|
|
05bba0 |
--- a/block/curl.c
|
|
|
05bba0 |
+++ b/block/curl.c
|
|
|
05bba0 |
@@ -132,7 +132,7 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
|
|
05bba0 |
DPRINTF("CURL: Just reading %zd bytes\n", realsize);
|
|
|
05bba0 |
|
|
|
05bba0 |
if (!s || !s->orig_buf)
|
|
|
05bba0 |
- goto read_end;
|
|
|
05bba0 |
+ return 0;
|
|
|
05bba0 |
|
|
|
05bba0 |
if (s->buf_off >= s->buf_len) {
|
|
|
05bba0 |
/* buffer full, read nothing */
|
|
|
05bba0 |
@@ -157,7 +157,6 @@ static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
|
|
|
05bba0 |
}
|
|
|
05bba0 |
}
|
|
|
05bba0 |
|
|
|
05bba0 |
-read_end:
|
|
|
05bba0 |
return realsize;
|
|
|
05bba0 |
}
|
|
|
05bba0 |
|
|
|
05bba0 |
--
|
|
|
05bba0 |
1.8.3.1
|
|
|
05bba0 |
|