block/curl: Do not wait for data beyond EOF
authorMax Reitz <mreitz@redhat.com>
Tue, 25 Oct 2016 02:54:31 +0000 (04:54 +0200)
committerJeff Cody <jcody@redhat.com>
Tue, 15 Nov 2016 03:47:34 +0000 (22:47 -0500)
commit4e504535c16dfa66290281e704384abfaca08673
tree3ce9bca295a9ee1cc047efbcde53c48f82358bf0
parentff5ca1664af85b24a4180d595ea6873fd3deac57
block/curl: Do not wait for data beyond EOF

libcurl will only give us as much data as there is, not more. The block
layer will deny requests beyond the end of file for us; but since this
block driver is still using a sector-based interface, we can still get
in trouble if the file size is not a multiple of 512.

While we have already made sure not to attempt transfers beyond the end
of the file, we are currently still trying to receive data from there if
the original request exceeds the file size. This patch fixes this issue
and invokes qemu_iovec_memset() on the iovec's tail.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20161025025431.24714-5-mreitz@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/curl.c