]> git.proxmox.com Git - qemu.git/commitdiff
qemu/iovec: Don't assert if sbytes is zero
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tue, 5 Feb 2013 05:57:45 +0000 (11:27 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 6 Feb 2013 14:29:50 +0000 (08:29 -0600)
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>
util/iov.c

index c0f5c566185c22828c8ec100435c949630b49e82..fbe675d3730b181a18cbd8a6c12d3057ddb97a30 100644 (file)
@@ -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) {