summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-23 19:17:32 +0100
committerHans de Goede <hdegoede@redhat.com>2011-03-23 19:17:32 +0100
commit0ec3622a1b26f8d8048e614d37ac9e8bf4276cbe (patch)
tree4f4c6ea83ac626cba6de5def84f0cd8fe3d95318
parent1cfccc9f642bee2b27890b12574ee62d39fccdef (diff)
vdagentd: fix potentially copying more data then a chunk holds when reading the header
-rw-r--r--vdagent-virtio-port.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vdagent-virtio-port.c b/vdagent-virtio-port.c
index 961b62c..a4411e5 100644
--- a/vdagent-virtio-port.c
+++ b/vdagent-virtio-port.c
@@ -204,6 +204,9 @@ static void vdagent_virtio_port_do_chunk(struct vdagent_virtio_port **portp)
if (port->message_header_read < sizeof(port->message_header)) {
read = sizeof(port->message_header) - port->message_header_read;
+ if (read > port->chunk_header.size) {
+ read = port->chunk_header.size;
+ }
memcpy((uint8_t *)&port->message_header + port->message_header_read,
port->chunk_data, read);
port->message_header_read += read;