[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 32/46] ivshmem-client: check the number of vector
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v3 32/46] ivshmem-client: check the number of vectors |
Date: |
Tue, 15 Sep 2015 18:07:49 +0200 |
From: Marc-André Lureau <address@hidden>
Check the number of vectors received from the server, to avoid
out of bound array access.
Signed-off-by: Marc-André Lureau <address@hidden>
---
contrib/ivshmem-client/ivshmem-client.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/contrib/ivshmem-client/ivshmem-client.c
b/contrib/ivshmem-client/ivshmem-client.c
index 11c805c..01e24a7 100644
--- a/contrib/ivshmem-client/ivshmem-client.c
+++ b/contrib/ivshmem-client/ivshmem-client.c
@@ -128,6 +128,10 @@ ivshmem_client_handle_server_msg(IvshmemClient *client)
/* new vector */
IVSHMEM_CLIENT_DEBUG(client, " new vector %d (fd=%d) for peer id %ld\n",
peer->vectors_count, fd, peer->id);
+ if (peer->vectors_count >= G_N_ELEMENTS(peer->vectors)) {
+ return -1;
+ }
+
peer->vectors[peer->vectors_count] = fd;
peer->vectors_count++;
--
2.4.3
- [Qemu-devel] [PATCH v3 26/46] ivshmem: add device description, (continued)
- [Qemu-devel] [PATCH v3 26/46] ivshmem: add device description, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 28/46] ivshmem: replace 'guest' for 'peer' appropriately, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 29/46] ivshmem: error on too many eventfd received, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 30/46] ivshmem: reset mask on device reset, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 32/46] ivshmem-client: check the number of vectors,
marcandre . lureau <=
- [Qemu-devel] [PATCH v3 33/46] ivshmem-server: use a uint16 for client ID, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 31/46] contrib: add ivshmem client and server, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 34/46] ivshmem-server: fix hugetlbfs support, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 35/46] docs: update ivshmem device spec, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 36/46] ivshmem: add check on protocol version in QEMU, marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 38/46] msix: implement pba write (but read-only), marcandre . lureau, 2015/09/15
- [Qemu-devel] [PATCH v3 37/46] contrib: remove unnecessary strdup(), marcandre . lureau, 2015/09/15