summaryrefslogtreecommitdiff
path: root/util/iov.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2013-02-05 11:27:45 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-06 08:29:50 -0600
commitfacf98ad987a38d97e12511f81375380b407a828 (patch)
tree653e1b5f4812e702f30adcb63610c19942f887c7 /util/iov.c
parentddcb73b7782cb6104479503faea04cc224f982b5 (diff)
qemu/iovec: Don't assert if sbytes is zero
Since these values can possibly be sent from guest (for hw/9pfs), do a sanity check on them. A 9p write request with 0 bytes caused qemu to abort without this patch Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'util/iov.c')
-rw-r--r--util/iov.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/iov.c b/util/iov.c
index c0f5c56618..fbe675d373 100644
--- a/util/iov.c
+++ b/util/iov.c
@@ -304,6 +304,10 @@ void qemu_iovec_concat_iov(QEMUIOVector *dst,
{
int i;
size_t done;
+
+ if (!sbytes) {
+ return;
+ }
assert(dst->nalloc != -1);
for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) {
if (soffset < src_iov[i].iov_len) {