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