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